Suspend Live HLS Stream

If I allowed the suspension of the real HLS stream, I could keep the * .ts files for a longer period, but how do I manage the m3u8 files?

As an example,

I watch live broadcast and want to pause for 5 minutes. When I click on the game again, I would continue from where it was paused. At this point, the m3u8 files will be overwritten by the last live segments, how do I save the old m3u8 files so that I can return to playing the old / paused segments?

Thanks!

+4
source share
1 answer

You can make your own playlist file in memory and only ever join it with data received from the web server. When the stream is paused, you still need to update the playlist. When resuming playback, the player software will still know its current position in the stream.

Just keep in mind that there is no guarantee that older segments will be available. Often, when you service HLS from a CDN, a lifetime of only a few minutes is used. After this period of time, the CDN will simply give 404. This may or may not be relevant in your case; it depends on who controls the network infrastructure.

+1
source

Source: https://habr.com/ru/post/1436411/


All Articles