- I have a live video with 5 min / 300 seconds backward seeking length (HLS media).
- I am able to play the video as a live stream.
- But when i seek back, it seeks up-to 56 seconds not 300 seconds, as player's window.getduration return 56 seconds (this is length of current live video).
- I tried to use MediaItem.ClippingConfiguration to set the start time of the player, but video is not playing in this case. Please see below code:
Can someone help me on this? How can i play live video and seek back and forward upto the duration of the recorded video contents (DVR)?
MediaItem.ClippingConfiguration config = new MediaItem.ClippingConfiguration.Builder()
.setStartPositionMs(300*1000)
.setEndPositionMs(100*1000)
.setRelativeToLiveWindow(true)
.setRelativeToDefaultPosition(true)
.setStartsAtKeyFrame(true)
.build();
MediaItem.Builder mediaItemBuilder = new MediaItem.Builder();
/* this is for HLS, getVideoUrl() returns the HLS url from the hosting activity*/
if (streamingQualitySelector != null && videoUrl != null && !TextUtils.isEmpty(videoUrl)) {
initiateSSAIAdsTracking();
mediaItemBuilder
.setUri(Uri.parse((videoUrl.trim())))
.setMediaMetadata(new MediaMetadata.Builder().setTitle(streamingQualitySelector.getFilmId()).build())
.setMimeType(adaptiveMimeType)
.setClippingConfiguration(config);
}