Merge branch 'master' into AndroidRangePlayback

This commit is contained in:
Yavor Ivanov 2023-02-13 18:15:06 +02:00
commit b65f94b27e
2 changed files with 11 additions and 2 deletions

6
API.md
View File

@ -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

View File

@ -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;
@ -836,9 +837,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;