Search code examples
vlchttp-live-streamingm3u8

VLC only plays some last segments of m3u8 file?


Here I have a manifest: index.m3u8 and 12 segments. My problem is that VLC player only play the last 5 segments in the manifest. This is my manifest:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:18
#EXTINF:12.960,
sample-0.ts
#EXTINF:10.640,
sample-1.ts
#EXTINF:18.440,
sample-2.ts
#EXTINF:10.000,
sample-3.ts
#EXTINF:12.920,
sample-4.ts
#EXTINF:10.800,
sample-5.ts
#EXTINF:13.400,
sample-6.ts
#EXTINF:12.240,
sample-7.ts
#EXTINF:11.720,
sample-8.ts
#EXTINF:15.320,
sample-9.ts
#EXTINF:13.200,
sample-10.ts
#EXTINF:10.480,
sample-11.ts
#EXTINF:11.800,
sample-12.ts

With this manifest, VLC plays from sample-8.ts. I tried to pull out some segment, leave sample-0.ts -> sample-7.ts, then VLC plays from sample-3.ts. What wrong with my manifest? Your help is very much appreciated.


Solution

  • You need to add the #EXT-X-ENDLIST tag to the end of the playlist, assuming you want it to start from the beginning. Without the end tag the player assumes it's a live playlist, which explains the behaviour you are seeing. You should also set the playlist type, e.g. #EXT-X-PLAYLIST-TYPE:VOD.