【问题标题】:Is it possible to use apple's HLS on tvOS是否可以在 tvOS 上使用苹果的 HLS
【发布时间】:2017-03-12 02:26:41
【问题描述】:

我想将直播频道流添加到我的 tvOS 应用。计划是使用苹果的 HLS 协议。

我尝试了苹果的 HLS 代码示例: https://developer.apple.com/videos/play/wwdc2016/504/

我添加了 import AVFoundation 然后添加了这段代码。

func setupAssetDownload() {
   let hlsAsset = AVURLAsset(url: assetURL)
   let backgroundConfiguration = URLSessionConfiguration.background(
      withIdentifier: "assetDownloadConfigurationIdentifier")
   let assetURLSession = AVAssetDownloadURLSession(configuration: backgroundConfiguration,
      assetDownloadDelegate: self, delegateQueue: OperationQueue.main())
   // Download a Movie at 2 mbps
   let assetDownloadTask = assetURLSession.makeAssetDownloadTask(asset: hlsAsset, assetTitle: "My Movie",
      assetArtworkData: nil, options: [AVAssetDownloadTaskMinimumRequiredMediaBitrateKey: 2000000])!
   assetDownloadTask.resume()
}

xcode 给我的“AVAssetDownloadURLSession”不可用

当我在 iOS 项目上尝试相同的代码时,它会识别 AVAssetDownloadURLSession 对象。

根据苹果文档,AVFoundeation 支持 tvOS 上的 HLS。

可能是什么问题?

【问题讨论】:

    标签: swift tvos live-streaming http-live-streaming


    【解决方案1】:

    目前在 tvOS 10 中,确实支持 HLS 播放,例如在加载像 AVURLPlayer(url: "https://example.com/123.m3u8") 这样的流时。

    很遗憾,AVAssetDownloadURLSession 目前(尚)不可用。提及 HLS 支持的 Apple 文档是指上述内容。

    【讨论】:

      猜你喜欢
      • 2020-06-25
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-03
      相关资源
      最近更新 更多