fix(android): keep lockscreen/media controls in sync with playback
The lockscreen controls drifted out of sync, especially while casting, and couldn't control remote playback. Two media sessions were competing (a Media3 MediaSession driving transport vs a MediaSessionCompat driving the notification), position was only pushed on play/pause so the scrubber froze mid-track, and remote mode showed stale local metadata with dead buttons. - Make MediaSessionCompat the single source of truth; route all transport commands (both the Compat callback and the Media3 wrappedPlayer) through Rust via nativeOnMediaCommand instead of touching ExoPlayer directly. - Push position on every 250ms tick via a lightweight updatePlaybackPosition, and report 0.0 playback speed when paused so Android stops extrapolating. - Mirror the remote session's now-playing onto the lockscreen from the native session poller (works while the screen is locked, unlike WebView timers) via a new player::update_lockscreen_metadata JNI bridge. - Make MediaSessionHandler mode-aware: in remote mode forward play/pause/next/ prev/seek to the remote Jellyfin session; Stop while casting emits RemoteDisconnectRequested, which the frontend handles by transferring to local. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1941,7 +1941,15 @@ export type PlayerStatusEvent =
|
||||
/**
|
||||
* Remote sessions updated (for cast/remote control UI)
|
||||
*/
|
||||
{ type: "sessions_updated"; sessions: SessionInfo[] }
|
||||
{ type: "sessions_updated"; sessions: SessionInfo[] } |
|
||||
/**
|
||||
* The user asked to disconnect from the remote session and resume locally.
|
||||
*
|
||||
* Emitted when the lockscreen Stop button is pressed while casting. The
|
||||
* frontend owns the two-step remote->local transfer (it must reload the
|
||||
* media item locally), so the native side only signals intent here.
|
||||
*/
|
||||
{ type: "remote_disconnect_requested" }
|
||||
/**
|
||||
* Result of creating a playlist
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user