ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Implement seeking within HLS moving live window in ExoPlayer and its demo app

Open perchrh opened this issue 12 years ago • 59 comments

The server may keep old chunks available to the streaming clients so that they can rewind the video, for example, to 10 minutes before the live position. Imagine you missed the start of a live tv-show or you were interrupted and missed a part, so you want to rewind it. There are two main, common cases here, the live playlist received by the clients can be of a short or a long duration.

  1. Often CDNs will give you a short playlist with 3-10 chunks, for a playlist duration of 2-3 minutes or less. In this case seeking inside the playlist is not very useful. Instead you would make a request to the CDN for a new playlist at a different position, for example live head - 20 minutes. The NASA TV public live stream is an example of this approach, http://www.nasa.gov/multimedia/nasatv/NTV-Public-IPS.m3u8

  2. The second case, that this issue covers, is where you get a long playlist, for example 120 chunks, or 1 hour, from the server. In this case seeking within the playlist is desirable. Because the server is continuously deleting old chunks (and writing new ones), you have a moving live window of a certain fixed size in seconds. The player/library must not request chunks outside of the window, as that will give an HTTP error (404). The seekbar must take the moving live window into consideration. While watching the stream, the seekbar should be in the same position, e.g. 10 minutes before live head. The playlist must be refetched when reaching the end of the playlist, or when the user seeks to the end of the playlist. The player UI could for example display "live" as the duration and "-10:00" for the current position when the user has rewinded the live video 10 minutes.

Please let me know if you would like a public sample stream for case (2).

perchrh avatar Oct 22 '14 12:10 perchrh

:+1:

crossle avatar Oct 23 '14 04:10 crossle

:+1:

miyaji27 avatar Dec 09 '14 03:12 miyaji27

Just as a heads up, we're likely to implement this for both DASH and SmoothStreaming before we do so for HLS, simply because DASH and SmoothStreaming are much better standards, and are more forward looking. I continue to advise looking at DASH, where a choice is possible.

ojw28 avatar Dec 09 '14 11:12 ojw28

+1 for seeking in live HLS content

martinbonnin avatar Dec 22 '14 10:12 martinbonnin

Another +1 for seeking in live HLS content

fougere-mike avatar Mar 31 '15 22:03 fougere-mike

Yet another +1 for seeking in live HLS content

zikavele avatar Apr 21 '15 18:04 zikavele

Is there an ETA on when is this going to be tackled down? Is there anybody working on it now or has an ExoPlayer workaround to support DVR?

ldimitroff avatar May 13 '15 14:05 ldimitroff

+1 as well

andreimarinescu avatar May 13 '15 14:05 andreimarinescu

+1 :)

zsmatyas avatar May 13 '15 18:05 zsmatyas

No promises, but we're aiming to add DVR window support for DASH by the end of this month. As we do that, we'll be looking at how the same approach can be used for HLS too, specifically for case (2) in the original post. Hopefully this wont be too hard, since they're roughly analogous to one another. I don't think we have near-term plans to support case (1) in the original post.

ojw28 avatar May 13 '15 19:05 ojw28

+1 for case (2)

Arqu avatar Jun 02 '15 11:06 Arqu

+1

Guro avatar Jun 05 '15 18:06 Guro

For anyone still waiting on this: I've implemented case 2 in a fork, and it's been working for my case.

Disclaimer: I have not tested adaptive bitrate streams. My streams do not use adaptive bitrates (variant switching). As a result, it may not work for many of you -- please use with caution. Hopefully the exoplayer devs will have an official implementation sometime soon.

https://github.com/fougere-mike/ExoPlayer/commits/mikef/hlsLiveSeeking

fougere-mike avatar Jul 21 '15 22:07 fougere-mike

@fougere-mike Hi, I am new to this HLS field and I have a question. Would it be possible to have like a 24 hours window? Also if I understand right, there is no DVR functionnality yet in ExoPlayer, so if I have a m3u8 playlist I won't be able to play it or seek in it.

Greg767 avatar Jul 27 '15 10:07 Greg767

@Greg767 With a fully implemented HLS spec you should be able to have a 24 hour window, and seek within that window. Currently ExoPlayer does not support that feature.

However, the fork I linked does support seeking within the window (not sure if it'll work with 24 hour window, but I don't see why it wouldn't). Keep in mind I haven't tested with adaptive bitrates, so it may not be what you need.

fougere-mike avatar Jul 27 '15 17:07 fougere-mike

@ojw28 hey, any update on this?

fougere-mike avatar Nov 12 '15 21:11 fougere-mike

Hi! https://github.com/PiotrGryko/ExoPlayer/tree/master/library

I have forked exoplayer library and made required changes to having livestream seekingbar working.

  1. progressBar.secondProgress indicates current livestream position. We can seek back/seek forward in range of buffered stream
  2. playerInternal.getDuration() returns duration of current video from the beginning of the user stream

I have forked the last version of library. And used it along with ExoMediaPlayer

The solution was not to replace current HlsMediaPlaylist as it was done with livestream. Instead of it I append old list with new segments and made it behaves similar to isAlive=false

PiotrGryko avatar Feb 09 '16 10:02 PiotrGryko

+1 for HLS live DVR

artnalban avatar Mar 15 '16 00:03 artnalban

Thanks On 15 Mar 2016 00:40, "Artur Nalbandian" [email protected] wrote:

+1 for HLS live DVR

— You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/google/ExoPlayer/issues/87#issuecomment-196587019

PiotrGryko avatar Mar 15 '16 00:03 PiotrGryko

https://github.com/google/ExoPlayer/pull/1394/commits/5cce28aacf3cc73c90830458d4a7e42bb6c2f452 patch has support for Seeking within Live DVR window. It handles adaptive bitrate switching as well as re-fetching live playlist to move the Live DVR window. I request people in this thread to try it out and let us know if there are any HLS live DVR content which has issues with this patch.

peddisri avatar Mar 26 '16 00:03 peddisri