Skip to content

Commit 483ffc9

Browse files
committed
onAndroid only enable play and pause when allowLivePlayPause is enabled
1 parent 145b54b commit 483ffc9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ private const val ALLOWED_PLAYBACK_ACTIONS = (
5151
PlaybackStateCompat.ACTION_REWIND or
5252
PlaybackStateCompat.ACTION_SET_PLAYBACK_SPEED)
5353

54+
private const val ALLOWED_PLAY_PAUSE_ACTIONS = (
55+
PlaybackStateCompat.ACTION_PLAY_PAUSE or
56+
PlaybackStateCompat.ACTION_PLAY or
57+
PlaybackStateCompat.ACTION_PAUSE)
58+
5459
class ReactTHEOplayerContext private constructor(
5560
private val reactContext: ThemedReactContext,
5661
private val configAdapter: PlayerConfigAdapter
@@ -180,9 +185,7 @@ class ReactTHEOplayerContext private constructor(
180185
val isInAd = player.ads.isPlaying
181186
mediaSessionConnector?.enabledPlaybackActions = when {
182187
// Allow trick-play for live events if configured
183-
isLive && mediaSessionConfig.allowLivePlayPause -> ALLOWED_PLAYBACK_ACTIONS xor
184-
PlaybackStateCompat.ACTION_FAST_FORWARD xor
185-
PlaybackStateCompat.ACTION_REWIND
188+
isLive && mediaSessionConfig.allowLivePlayPause -> ALLOWED_PLAY_PAUSE_ACTIONS
186189
isLive && !mediaSessionConfig.allowLivePlayPause -> 0
187190
// Do not allow playback actions during ad play-out
188191
isInAd -> 0

0 commit comments

Comments
 (0)