我怎么知道我是否已经播放过一段M3U8视频? [英] How can I know if I've already played a segment of an M3U8 video?

查看:62
本文介绍了我怎么知道我是否已经播放过一段M3U8视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个m3u8播放器,有一个小问题.我尝试播放的一个m3u8视频返回的媒体序列与片段文件名无关,并且文件名会永远重复.我怎么知道我是否已经玩过给定的片段?

I'm writing an m3u8 player and have a small issue. One m3u8 video I'm trying to play returns a media sequence that has nothing to do with the segment file names and the file names repeat themselves forever. How can I know if I already played a given segment?

这是几秒钟后的请求样子:

This is what the requests look like over a few seconds:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:5609
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:10
#EXTINF:10.000000,
channel001.ts
#EXTINF:10.000000,
channel000.ts

然后几秒钟:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:5610
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:10
#EXTINF:10.000000,
channel000.ts
#EXTINF:10.000000,
channel001.ts

然后再过几秒钟:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:5611
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:10
#EXTINF:10.000000,
channel001.ts
#EXTINF:10.000000,
channel000.ts

所以段名是相同的,媒体序列并不能告诉我很多.我怎么知道我是否已经演奏过那些特定的片段?

so the segment names are the same, the media sequence doesn't tell me much. How can I know if I already played those specific segments?

谢谢.

推荐答案

段名称无关紧要,您始终使用媒体序列.每次将片段从播放列表中删除时, MEDIA-SEQUENCE 都会递增.

The segment names don't matter, you always use the media sequence. MEDIA-SEQUENCE is incremented each time a segment is removed from the playlist.

3.媒体细分

...

媒体播放列表中的每个片段都有一个唯一的整数媒体序列数字.媒体中第一个片段的媒体序列号播放列表为0或在播放列表中声明(第4.3.3.2节).每隔一段的媒体序号等于之前的段的媒体序列号加1.

Each segment in a Media Playlist has a unique integer Media Sequence Number. The Media Sequence Number of the first segment in the Media Playlist is either 0 or declared in the Playlist (Section 4.3.3.2). The Media Sequence Number of every other segment is equal to the Media Sequence Number of the segment that precedes it plus one.

6.3.5.确定下一个要加载的细分

...

要加载的第一个细分通常是客户端的细分选择先播放(请参阅第6.3.3节).

The first segment to load is generally the segment that the client has chosen to play first (see Section 6.3.3).

为了正常播放演示文稿,请在下一个媒体段负载是具有最低媒体序列号的那个,它更大比最后加载的媒体段的媒体序列号要多.

In order to play the presentation normally, the next Media Segment to load is the one with the lowest Media Sequence Number that is greater than the Media Sequence Number of the last Media Segment loaded.

RFC 8216-HTTP实时流

这篇关于我怎么知道我是否已经播放过一段M3U8视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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