ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Question:How to check DVR window for live dash stream.

Open jiafei1986 opened this issue 9 years ago • 2 comments

I am doing a video app with exoplayer v2 libs, there is a requirement that user can pause the player. i need to seek to live edge if the user pauses for a long time, for example if the live stream duration is 10 mins(duration may be dynamic), then the user pauses for 15 mins, so i need to seek to live edge if resume. is there a way to check whether the current play position out of the duration?

Thanks in advance

jiafei1986 avatar Jul 25 '17 02:07 jiafei1986

player.getCurrentPosition() will return the position relative to the start of the current window, which has duration player.getDuration(). If you need more information about the live window, get the current window index using player.getCurrentWindowIndex() and then look this up in the Timeline returned by player.getCurrentTimeline(). Read the documentation on Timeline for more information. To seek to live edge, call player.seekToDefaultPosition() (as per your previous question #3056). When the DVR window changes, EventListener.onTimelineChanged will be called with the new Timeline.

I'm not sure exactly what you mean by "check whether the current play position out of the duration" so please clarify if I haven't answered the question.

andrewlewis avatar Jul 25 '17 09:07 andrewlewis

@andrewlewis Thanks for your reply. i will try it.

jiafei1986 avatar Jul 26 '17 02:07 jiafei1986