Reputation: 61
I'm writing a tvOS app using TVJS and TVML. But it seems cannot play videos with specific HTTP header.
Is there any way to do that?
Upvotes: 0
Views: 268
Reputation: 1392
You can add header to AVPlayer when you set the AssetURL like that :
var headers: [String:String] = ["HeaderKey": "HeaderValue"]
let asset: AVURLAsset = AVURLAsset.URLAssetWithURL(url!, options: ["AVURLAssetHTTPHeaderFieldsKey": headers])
let playerItem = AVPlayerItem(asset)
player.replaceCurrentItemWithPlayerItem(playerItem)
player.play()
Upvotes: 1