From 172954de5ae5a09bff92c9808dc1ebf1adb3a7f1 Mon Sep 17 00:00:00 2001 From: sridhar Date: Thu, 24 Jan 2019 18:49:37 +0530 Subject: [PATCH] Feature implementation: Failure Retry Count Feature implementation: Failure Retry Count --- Video.js | 1 + .../exoplayer/ReactExoplayerView.java | 17 ++++++++++++++--- .../exoplayer/ReactExoplayerViewManager.java | 6 ++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Video.js b/Video.js index 92544467..703aef5e 100644 --- a/Video.js +++ b/Video.js @@ -339,6 +339,7 @@ Video.propTypes = { // Opaque type returned by require('./video.mp4') PropTypes.number ]), + failureRetryCount: PropTypes.number, maxBitRate: PropTypes.number, resizeMode: PropTypes.string, poster: PropTypes.string, diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 64c8a404..08021479 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -114,6 +114,7 @@ class ReactExoplayerView extends FrameLayout implements private boolean isBuffering; private float rate = 1f; private float audioVolume = 1f; + private int failureRetryCount = 3; private int maxBitRate = 0; private long seekTime = C.TIME_UNSET; @@ -310,12 +311,17 @@ class ReactExoplayerView extends FrameLayout implements switch (type) { case C.TYPE_SS: return new SsMediaSource(uri, buildDataSourceFactory(false), - new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, null); + new DefaultSsChunkSource.Factory(mediaDataSourceFactory), + failureRetryCount, SsMediaSource.DEFAULT_LIVE_PRESENTATION_DELAY_MS, + mainHandler, null); case C.TYPE_DASH: return new DashMediaSource(uri, buildDataSourceFactory(false), - new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, null); + new DefaultDashChunkSource.Factory(mediaDataSourceFactory), + failureRetryCount, DashMediaSource.DEFAULT_LIVE_PRESENTATION_DELAY_MS, + mainHandler, null); case C.TYPE_HLS: - return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, null); + return new HlsMediaSource(uri, mediaDataSourceFactory, + failureRetryCount, mainHandler, null); case C.TYPE_OTHER: return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(), mainHandler, null); @@ -998,6 +1004,11 @@ class ReactExoplayerView extends FrameLayout implements } } + public void setfailureRetryCountModifier(int newFailureRetryCount) { + failureRetryCount = newFailureRetryCount; + releasePlayer(); + initializePlayer(); + } public void setPlayInBackground(boolean playInBackground) { this.playInBackground = playInBackground; diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java index 31bd8e08..de162f97 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java @@ -48,6 +48,7 @@ public class ReactExoplayerViewManager extends ViewGroupManager