问题
I am trying to create an infinite HLS stream. The idea is that the server sends the same fragments meaning that once the last fragment is sent the first one is sent again. As far as I know I have to use the EXT-X-DISCONTINUITY-SEQUENCE tag. Here is my initial manifest
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:NO
#EXT-X-VERSION:2
#EXT-X-TARGETDURATION:8
#EXTINF:8,
fragment0.ts
#EXTINF:8,
fragment1.ts
#EXTINF:8,
fragment2.ts
#EXTINF:8,
fragment3.ts
#EXTINF:8,
fragment4.ts
#EXTINF:8,
fragment5.ts
#EXTINF:8,
fragment6.ts
#EXTINF:4,
fragment7.ts
This is what it looks like once the stream starts and fragment 0 gets pushed to the bottom.
#EXTM3U
#EXT-X-DISCONTINUITY-SEQUENCE:0
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:NO
#EXT-X-VERSION:2
#EXT-X-TARGETDURATION:8
#EXTINF:8,
fragment1.ts
#EXTINF:8,
fragment2.ts
#EXTINF:8,
fragment3.ts
#EXTINF:8,
fragment4.ts
#EXTINF:8,
fragment5.ts
#EXTINF:8,
fragment6.ts
#EXTINF:4,
fragment7.ts
#EXT-X-DICONTINUITY
#EXTINF:8,
fragment0.ts
Once fragment 0 comes to the top I increment EXT-X-DISCONTINUITY-SEQUENCE. This does not seem to work tho, does anyone have an idea why ?
回答1:
Every time a fragment gets removed from the top the EXT-X-MEDIA-SEQUENCE
must be incremented by 1. So after fragment0.ts
drops out at the top it must say #EXT-X-MEDIA-SEQUENCE:1
in the playlist.
Note, that the #EXT-X-DICONTINUITY
will end up at the top of the playlist after some time and when it drops out the EXT-X-DISCONTINUITY-SEQUENCE
must be incremented by 1 as well.
来源:https://stackoverflow.com/questions/50795350/how-to-use-ext-x-discontinuity-sequence-when-creating-an-infinite-hls-stream-tha