From 31b43f232bd9fe86894373c64625465452492d52 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 13 Feb 2023 17:57:13 +0200 Subject: [PATCH 1/2] android support for partial video range --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 00983c4e..8e4e9850 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -4,6 +4,7 @@ import static com.google.android.exoplayer2.C.CONTENT_TYPE_DASH; import static com.google.android.exoplayer2.C.CONTENT_TYPE_HLS; import static com.google.android.exoplayer2.C.CONTENT_TYPE_OTHER; import static com.google.android.exoplayer2.C.CONTENT_TYPE_SS; +import static com.google.android.exoplayer2.C.TIME_END_OF_SOURCE; import android.annotation.SuppressLint; import android.app.Activity; @@ -844,9 +845,13 @@ class ReactExoplayerView extends FrameLayout implements } } - if(startTimeMs >= 0 && endTimeMs >= 0) + if (startTimeMs >= 0 && endTimeMs >= 0) { return new ClippingMediaSource(mediaSource, startTimeMs * 1000, endTimeMs * 1000); + } else if (startTimeMs >= 0) { + return new ClippingMediaSource(mediaSource, startTimeMs * 1000, TIME_END_OF_SOURCE); + } else if (endTimeMs >= 0) { + return new ClippingMediaSource(mediaSource, 0, endTimeMs * 1000); } return mediaSource; From dd4e50fca31fa92c2e09388fe9eef4270ece1b13 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 13 Feb 2023 18:14:20 +0200 Subject: [PATCH 2/2] updated documentation --- API.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/API.md b/API.md index 1a012085..ff968f06 100644 --- a/API.md +++ b/API.md @@ -922,7 +922,11 @@ Provide an optional `startTime` and/or `endTime` for the video. Value is in mill Example ``` -source={{ startTime: 36012, endTime: 48500 }} +source={{ uri: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', startTime: 36012, endTime: 48500 }} + +source={{ uri: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', startTime: 36012 }} + +source={{ uri: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', endTime: 48500 }} ``` Platforms: iOS, Android