mirror of
https://github.com/sudoxnym/audiobookshelf-atv.git
synced 2026-04-14 19:46:30 +00:00
Fix:When stopping cast progress reverts back to initial progress #314
This commit is contained in:
parent
7c3b6c9702
commit
34d4a0b61b
1 changed files with 15 additions and 7 deletions
|
|
@ -475,7 +475,6 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
return
|
||||
} else {
|
||||
Log.d(tag, "switchToPlayer: Switching to cast player from exo player stop exo player")
|
||||
isSwitchingPlayer = true
|
||||
mPlayer.stop()
|
||||
}
|
||||
} else {
|
||||
|
|
@ -484,11 +483,22 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
return
|
||||
} else if (castPlayer != null) {
|
||||
Log.d(tag, "switchToPlayer: Switching to exo player from cast player stop cast player")
|
||||
isSwitchingPlayer = true
|
||||
castPlayer?.stop()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPlaybackSession == null) {
|
||||
Log.e(tag, "switchToPlayer: No Current playback session")
|
||||
} else {
|
||||
isSwitchingPlayer = true
|
||||
}
|
||||
|
||||
// Playback session in progress syncer is a copy that is up-to-date so replace current here with that
|
||||
// TODO: bad design here implemented to prevent the session in MediaProgressSyncer from changing while syncing
|
||||
if (mediaProgressSyncer.currentPlaybackSession != null) {
|
||||
currentPlaybackSession = mediaProgressSyncer.currentPlaybackSession?.clone()
|
||||
}
|
||||
|
||||
currentPlayer = if (useCastPlayer) {
|
||||
Log.d(tag, "switchToPlayer: Using Cast Player " + castPlayer?.deviceInfo)
|
||||
mediaSessionConnector.setPlayer(castPlayer)
|
||||
|
|
@ -503,15 +513,13 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
|
||||
clientEventEmitter?.onMediaPlayerChanged(getMediaPlayer())
|
||||
|
||||
if (currentPlaybackSession == null) {
|
||||
Log.d(tag, "switchToPlayer: No Current playback session")
|
||||
}
|
||||
|
||||
currentPlaybackSession?.let {
|
||||
Log.d(tag, "switchToPlayer: Preparing current playback session ${it.displayTitle}")
|
||||
Log.d(tag, "switchToPlayer: Starting new playback session ${it.displayTitle}")
|
||||
if (wasPlaying) { // media is paused when switching players
|
||||
clientEventEmitter?.onPlayingUpdate(false)
|
||||
}
|
||||
|
||||
// TODO: Start a new playback session here instead of using the existing
|
||||
preparePlayer(it, false, null)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue