pub struct SessionPollerManager {
jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>,
playback_mode_manager: Arc<PlaybackModeManager>,
event_emitter: Arc<Mutex<Option<Arc<dyn PlayerEventEmitter>>>>,
connectivity_reporter: Arc<Mutex<Option<ConnectivityReporter>>>,
is_running: Arc<AtomicBool>,
current_hint: Arc<RwLock<PollingHint>>,
current_interval_ms: Arc<AtomicU64>,
thread_handle: Arc<Mutex<Option<JoinHandle<()>>>>,
}Expand description
Manages background polling of Jellyfin sessions
Fields§
§jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>§playback_mode_manager: Arc<PlaybackModeManager>§event_emitter: Arc<Mutex<Option<Arc<dyn PlayerEventEmitter>>>>§connectivity_reporter: Arc<Mutex<Option<ConnectivityReporter>>>Optional connectivity reporter. The session poller is the one piece of server traffic that runs continuously even when the user is idle (not browsing the library), so feeding its poll outcomes into the reporter is what lets the app detect going offline — and, crucially, recover when the server returns — without any user interaction. Repository traffic alone can’t do this because it only happens while browsing.
is_running: Arc<AtomicBool>§current_hint: Arc<RwLock<PollingHint>>§current_interval_ms: Arc<AtomicU64>§thread_handle: Arc<Mutex<Option<JoinHandle<()>>>>Implementations§
Source§impl SessionPollerManager
impl SessionPollerManager
Sourcepub fn new(
jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>,
playback_mode_manager: Arc<PlaybackModeManager>,
) -> Self
pub fn new( jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>, playback_mode_manager: Arc<PlaybackModeManager>, ) -> Self
Create a new SessionPollerManager
Sourcepub fn set_event_emitter(&self, emitter: Arc<dyn PlayerEventEmitter>)
pub fn set_event_emitter(&self, emitter: Arc<dyn PlayerEventEmitter>)
Set event emitter for broadcasting session updates
Sourcepub fn set_connectivity_reporter(&self, reporter: ConnectivityReporter)
pub fn set_connectivity_reporter(&self, reporter: ConnectivityReporter)
Wire the connectivity reporter so each poll outcome updates reachability. A successful poll recovers the app to online instantly; sustained poll failures flip it offline (subject to the reporter’s debounce window).
Sourcepub fn set_polling_hint(&self, hint: PollingHint)
pub fn set_polling_hint(&self, hint: PollingHint)
Set UI hint for polling frequency adjustment
Sourcefn push_remote_lockscreen(sessions: &[SessionInfo], session_id: &str)
fn push_remote_lockscreen(sessions: &[SessionInfo], session_id: &str)
Push the remote session’s now-playing onto the Android lockscreen.
Looks up the active remote session by id and forwards its title/artist/ album, duration and position to the media notification. Silently does nothing if the session isn’t found or has no now-playing item (e.g. the remote stopped) - the next state change will refresh it.
Sourcefn calculate_interval(mode: &PlaybackMode, hint: PollingHint) -> u64
fn calculate_interval(mode: &PlaybackMode, hint: PollingHint) -> u64
Calculate polling interval based on mode and hint