[英]Is it possible to get the current date of an HTTP Live Stream being played through AirPlay?
Working on an iOS project that uses HTTP Live Streaming (HLS), we found that when the app uses AirPlay, to play the streaming on a Apple TV, the currentDate
property of the currentItem
of the AVPlayer returns nil
. 在使用HTTP直播 (HLS)的iOS项目上工作时,我们发现当应用程序使用AirPlay时,要在Apple TV上播放流媒体,AVPlayer的
currentItem
的currentDate
属性返回nil
。 In other words: 换一种说法:
AVPlayerItem *item = [player currentItem]; //Where "player" is the AVPlayer object.
NSDate *date = [item currentDate]; //date is nil, when using AirPlay.
So, is it possible to get that currentDate by other means? 那么,是否可以通过其他方式获得当前日期?
You should include EXT-X-PROGRAM-DATE-TIME
tag info in your m3u8 files. 您应该在m3u8文件中包含
EXT-X-PROGRAM-DATE-TIME
标记信息。 For example, if I created a live stream at 2017/7/12 12:00:00 例如,如果我在2017/7/12 12:00:00创建了直播
I should add 我应该补充一下
#EXT-X-PROGRAM-DATE-TIME:2017-07-12T12:00:00.000Z
in my .m3u8 header #EXT-X-PROGRAM-DATE-TIME:2017-07-12T12:00:00.000Z
在我的.m3u8标题中
and you will get currentDate when you call the method in playerItem.(However, that date info is only supported to s
not ms
unit.) 当你在playerItem中调用方法时,你将获得currentDate。(但是,该日期信息仅支持
s
而不是ms
单位。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.