2

I can play a live stream with the hls.js player using playlists master.m3u8, video.m3u8 and metadata.m3u8. The video is created using ffmpeg hls commands and is using a rolling live window with the args:

-hls_list_size 20 -hls_time 2 -hls_flags delete_segments

This creates video fragments starting with video0.ts to video19.ts, then starts removing the first fragments as it adds new ones. The video.m3u8 eventually looks like...

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:25
#EXTINF:2.002133,
video25.ts
#EXTINF:2.002133,
video26.ts
...

My metadata.m3u8 playlist looks similar though I am creating that from a separate source. The video and metadata playlist are kept in sync and play fine from the start of my live.

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:25
#EXTINF:2.000
sub_25.vtt
#EXTINF:2.000
sub_26.vtt
...

The problem starts when I reload the player page. On a reload, the player loads the playlists and will play correctly at the current live point.

I see it load fragments around video45.ts and sub_45.vtt. This is seemingly correct as the media sequence in video.m3u8 is at 25. Add in the 20 fragment playlist size and the live position is around 45th fragment. This is around 90 seconds into the live.

However, the media time in the player shows 40 seconds. It seems to use the number of fragments in the playlist only to come up with 40 seconds, even though the real live time is 90 seconds.

The final resulting problem is that the 40 second media time is being used to reference the text track cues and showing captions for 40 seconds.. not 90 seconds mark where the video actually is from.

Is there a way to get the player to correctly reflect the 'real' time, despite the rolling window of live, so the captions (which are correctly loaded) to display at the correct time?

Or is the rolling window live playback not going to work with subtitles in vtt?

If I disable the rolling window support I can reload the live many times and the 'full' live time loads and the captions line up ok.

FredArters
  • 420
  • 4
  • 14

0 Answers0