SimpleExoPlayer in android not allowing to seek previous part of video

1k Views Asked by At

The DRM live content length is know to us from the our api call. And that is 60 minutes. We are using SimpleExoPlayer to play this DRM content. Code snippet to prepare player is below.

player?.playWhenReady = false
player?.setMediaSource(mediaSource)
player?.prepare()

Problem: We like to provide the seek option for the DRM live content. The problem is, at any point of time our video is available only the 5 minutes of duration. Checked the length of the video with the player api calls. player?.getDuration() and it is always 5 minutes duration.

That means: Live content length is 60 minutes. And the current position is at 30 minute. Here player can seek back only between 25 minute to 30 minute.

Seek to position:

player?.seekTo(26*60*1000) (26 Minutes Works)
player?.seekTo(10*60*1000) (10 Minutes NOT Working)
player?.seekTo(45*60*1000) (45 Minutes NOT Working)

But we like to seek the player from 1 minute time to 30 minute time at any place. We couldn't find any solution from the document and technical discussion forums.

Any suggestion or clues would help us.

1

There are 1 best solutions below

1
On

When HLS or DASH live content is streamed, the streaming server will typically set a window for availability for the content.

Even if there is no catch up or 'live rewind' service planned, the server has to allow for network delays etc and provide a reasonable window to allow clients request the segments.

Once this window expires, the server will (usually...) no longer serve the segments, so any request for a segment before this time will result in some sort of error response.

If the plan is to support rewind then a bigger window would typically be used.

You can check the manifest to see the setting for a given stream:

  • for DASH look at the 'timeShiftBufferDepth' in he manifest file (.mpd file)
  • for HLS look at live m3u8 streams - you will see the list of segments being updated and older ones dropping off. Note a HLS live stream can usually be identified by it not having an 'EXT-X-ENDLIST' tag. This is the tag that indicates there will be no more segments.

The player could store the content locally after it has played it to allow rewind, but this is rarely the default behaviour. If you do store the content on the player side you also need to make sure that any DRM licenses needed to decrypt the content are still valid when you playback. You can also only rewind back to the point the player started storing the content also, which may not be the required functionality in many cases.