【问题标题】:Is it possible to get the current date of an HTTP Live Stream being played through AirPlay?是否可以通过 AirPlay 获取正在播放的 HTTP 直播流的当前日期?
【发布时间】:2013-10-31 20:13:55
【问题描述】:

在处理一个使用 HTTP Live Streaming (HLS) 的 iOS 项目时,我们发现当应用使用 AirPlay 在 Apple TV 上播放流媒体时, AVPlayer 的currentItemcurrentDate 属性返回nil。换句话说:

AVPlayerItem *item = [player currentItem]; //Where "player" is the AVPlayer object.
NSDate *date = [item currentDate]; //date is nil, when using AirPlay.

那么,是否有可能通过其他方式获得该 currentDate ?

【问题讨论】:

    标签: ios iphone avplayer http-live-streaming airplay


    【解决方案1】:

    您应该在 m3u8 文件中包含 EXT-X-PROGRAM-DATE-TIME 标签信息。 例如,如果我在 2017/7/12 12:00:00 创建了一个直播

    我应该添加

    #EXT-X-PROGRAM-DATE-TIME:2017-07-12T12:00:00.000Z 在我的 .m3u8 标头中

    当您调用 playerItem 中的方法时,您将获得 currentDate。(但是,该日期信息仅支持 s 不支持 ms 单位。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-04
      • 2015-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 2018-02-20
      • 1970-01-01
      相关资源
      最近更新 更多