在创建循环遍历相同片段的无限HLS流时如何使用EXT-X-DISCONTINUITY-SEQUENCE [英] How to use EXT-X-DISCONTINUITY-SEQUENCE when creating an infinite HLS stream that loops over same fragments

查看:70
本文介绍了在创建循环遍历相同片段的无限HLS流时如何使用EXT-X-DISCONTINUITY-SEQUENCE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建无限的HLS流.这个想法是服务器发送相同的片段,这意味着一旦发送了最后一个片段,便会再次发送第一个片段.据我所知,我必须使用EXT-X-DISCONTINUITY-SEQUENCE标签.这是我的最初清单

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

这是流一旦开始并且片段0被推到底部的样子.

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

一旦片段0到达顶部,我将递增EXT-X-DISCONTINUITY-SEQUENCE.这似乎不起作用,有人知道为什么吗?

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 ?

推荐答案

每次从顶部移除片段时, EXT-X-MEDIA-SEQUENCE 都必须增加1.因此在 fragment0.ts 放在顶部,必须在播放列表中说#EXT-X-MEDIA-SEQUENCE: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.

请注意,一段时间后,当#EXT-X-DICONTINUITY 退出 EXT-X-DISCONTINUITY-SEQUENCE 时,它将排在播放列表的顶部.code>也必须增加1.

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.

这篇关于在创建循环遍历相同片段的无限HLS流时如何使用EXT-X-DISCONTINUITY-SEQUENCE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆