【发布时间】: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