Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fix: uncaught exception when CastSession ends in "CAST_ONLY" mode
--------------------------------------------------------------------- issue: * uncaught exception leads to crash steps to reproduce: * pause "VideoActivity" * click "stop" on TV remote control to end CastSession --------------------------------------------------------------------- CastPlayer: =========== onSessionEnded() -> setRemoteMediaClient(null) -> sessionAvailabilityListener.onCastSessionUnavailable() VideoManager: ============= onCastSessionUnavailable() -> release(false) -> release_castPlayer(false) -> castPlayer.release() CastPlayer: =========== release() -> sessionManager.endCurrentSession(false) -> ERROR: because this entire chain of events started when the current session ended.. solution: ========= in: VideoManager in: -> onCastSessionUnavailable old: -> release(false) new: -> release(true) // retain_cast_session --------------------------------------------------------------------- old: ==== @OverRide public void onCastSessionUnavailable() { if (castPlayer == null) return; if (playbackMode == PlaybackMode.CAST_ONLY) { setPlaybackMode(PlaybackMode.RELEASED); } else { setCurrentPlayer(exoPlayer); } } new: ==== @OverRide public void onCastSessionUnavailable() { if (castPlayer == null) return; if (playbackMode == PlaybackMode.CAST_ONLY) { setPlaybackMode(PlaybackMode.RELEASED_ALL_BUT_CAST_SESSION); } else { setCurrentPlayer(exoPlayer); } } ---------------------------------------------------------------------
- Loading branch information