diff --git a/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt b/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt index 84b86310..db019681 100644 --- a/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt +++ b/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt @@ -142,17 +142,17 @@ class RNPlayerView( // remove player from view so it does not get paused when entering background private fun removePlayerForBackgroundPlayback() { playerInMediaSessionService = null - playerView?.player?.let { - if (!enableBackgroundPlayback) { - return - } - if (context.playerModule?.mediaSessionPlaybackManager?.player != it) { - return - } - - playerInMediaSessionService = it - playerView?.player = null + val player = playerView?.player ?: return + + if (!enableBackgroundPlayback) { + return + } + if (context.playerModule?.mediaSessionPlaybackManager?.player != player) { + return } + + playerInMediaSessionService = player + playerView?.player = null } }