The client has multiple short videos available via his rest API, he wants to generate an m3u8 from them which behaves like a live stream.
I wrote a PHP script, it continuously loops through the available videos, adds them to the m3u8, and deletes the oldest streams from the file, such that the end-user can't go back in the stream nor go forward that much, just like a live stream. The file always gets autogenerated every minute, it's always overwritten and the resulting m3u8 is uploaded to the S3 bucket.
This is what the m3u8 looks like currently
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:20
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:10.0,
https://example.com/video/uv10774862h/774862h_w254909923_0.ts
#EXT-X-DISCONTINUITY
#EXTINF:18.76,
https://example.com/video/uv10774862h/774862h_w254909923_1.ts
#EXT-X-DISCONTINUITY
#EXTINF:11.28,
https://example.com/video/uv10774862h/774862h_w254909923_2.ts
#EXT-X-DISCONTINUITY
#EXTINF:3.96,
https://example.com/video/uv10774862h/774862h_w254909923_3.ts
The problem is that the video player gets stuck at a random segment during the video stream. Sometimes in the middle or 3 seconds before the end of the last stream.
- Should there be multiple
MEDIA-SEQUENCEin a live m3u8? - Is
TARGETDURATIONneeded? I prefer if the video player can guess the target duration so that I don't have to keep track of it. - Should anything be added to the m3u8 so the video player doesn't get stuck while buffering? Is the template I'm using correct for a live stream?