android support for partial video range

This commit is contained in:
Yavor Ivanov 2023-02-13 17:57:13 +02:00
parent 63625b3ce3
commit 31b43f232b

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_HLS;
import static com.google.android.exoplayer2.C.CONTENT_TYPE_OTHER; 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.CONTENT_TYPE_SS;
import static com.google.android.exoplayer2.C.TIME_END_OF_SOURCE;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; 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); 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; return mediaSource;