This project has moved and is read-only. For the latest updates, please go here.

HLS Question

Jun 13, 2014 at 10:58 PM
Hey Henric,

Thanks for an awesome library -

Just a question Im sure you can assist with.

Basically I have an HLS stream and when on a slow connection (using simulation dashboard 2G) the segment readers are trying to fetch a segment that has already been removed by the server (took that long to buffer) and thus come back with multiple 404's and eventually just crash the stream and the MediaElement.

Where would be the best place to skip to the newest playlist since we're now so far behind?

What would be the best way to handle this in phonesm?

Appreciate it!
Jun 14, 2014 at 1:39 AM
A stop/play should do it. I had some code that would seek to the current time, but I'm not sure what happened to it (I think it was in a local fork that got so messed up that I just deleted the whole mess). Anyhow, it shouldn't be too difficult to get a hold of the current timestamp from IBufferingManager, and then seek to that time, minus a few seconds. I don't know if you can do the seek through MediaElement; it may need to go directly to the phonesm code since it tells MediaElement that dynamic (live) streams are not seekable. Another approach might be to change HlsPlaylistSegmentManager (what used to be called PlaylistSegmentManager) such that seeks in dynamic playlists are treated as relative to the current timestamp. Hmm...

Another potentially serious problem is if the 404s are intermittent enough to cause the timestamp to jump around. This can confuse the MediaElement to the point where it throws up its virtual hands. I'm not sure how effective the TsTimestamp code is in handling that sort of thing.

I've been meaning to rework how the processing pipeline works in order to better deal with this sort of thing, but I haven't had a solid block of time I can devote to that effort.