Skip to content

Commit 9c3f98a

Browse files
authored
AndroidTv support 'isPlayPauseEnabled' param (#453)
* fix: add 'skipMarker' button click track event * fix: update version to 7.12.3 * fix: support disable play pause feature * bump doris to 5.2.4
1 parent c840505 commit 9c3f98a

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactTVExoplayerView.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ class ReactTVExoplayerView extends FrameLayout implements LifecycleEventListener
205205
private boolean hasStats;
206206
private boolean hideAdUiElements;
207207
private boolean isWhyThisAdIconEnabled;
208+
private boolean isPlayPauseEnabled = true;
208209
private float jsProgressUpdateInterval = 250.0f;
209210
// \ End props
210211

@@ -557,6 +558,7 @@ private void doInitializePlayer(boolean force) {
557558
exoDorisPlayerView,
558559
src.getTracksPolicy());
559560

561+
player.setMediaSessionPlayPauseEnabled(isPlayPauseEnabled);
560562
player.setOutput(dorisListener);
561563
trackSelector = player.getTrackSelector();
562564
ExoPlayer exoPlayer = player.getExoPlayer();
@@ -1874,6 +1876,11 @@ public void setIs4K(boolean is4K) {
18741876
exoDorisPlayerView.setIs4K(is4K);
18751877
}
18761878

1879+
public void setPlayPauseEnabled(boolean playPauseEnabled) {
1880+
isPlayPauseEnabled = playPauseEnabled;
1881+
exoDorisPlayerView.setPlayPauseEnabled(playPauseEnabled);
1882+
}
1883+
18771884
private boolean isUnauthorizedAdError(Exception error) {
18781885
return error.getMessage().contains("HTTP status code: 403");
18791886
}

android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactTVExoplayerViewManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public class ReactTVExoplayerViewManager extends ViewGroupManager<ReactTVExoplay
147147
private static final String PROP_SUBTITLE_HORIZONTAL_PADDING = "subtitleHorizontalPadding";
148148
private static final String PROP_LOCALE = "locale";
149149
private static final String PROP_IS4K = "is4K";
150+
private static final String PROP_IS_PLAY_PAUSE_ENABLED = "isPlayPauseEnabled";
150151

151152
private static final int COMMAND_SEEK_TO_POSITION = 4;
152153
private static final int COMMAND_REPLACE_AD_TAG_PARAMETERS = 5;
@@ -638,6 +639,11 @@ public void setLocale(final ReactTVExoplayerView videoView, final String locale)
638639
videoView.setAppLanguageLocale(locale);
639640
}
640641

642+
@ReactProp(name = PROP_IS_PLAY_PAUSE_ENABLED)
643+
public void setIsPlayPauseEnabled(final ReactTVExoplayerView videoView, boolean isPlayPauseEnabled) {
644+
videoView.setPlayPauseEnabled(isPlayPauseEnabled);
645+
}
646+
641647
private boolean startsWithValidScheme(String uriString) {
642648
if (uriString == null) {
643649
return false;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-video",
3-
"version": "7.12.5",
4-
"dorisAndroidVersion": "5.2.1",
3+
"version": "7.12.6",
4+
"dorisAndroidVersion": "5.2.4",
55
"messagingAndroidVersion": "1.1.0",
66
"description": "A <Video /> element for react-native",
77
"main": "Video.tsx",

0 commit comments

Comments
 (0)