could you please help with setting User Agent for AVPlayer?
I have a following code:
    let url = NSURL(string:"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")
    var headers: [String:String] = ["User-Agent": "myagent"]
    let asset: AVURLAsset = AVURLAsset.URLAssetWithURL(url!, options: ["AVURLAssetHTTPHeaderFieldsKey": headers])
    let playerItem = AVPlayerItem(asset)
    player.replaceCurrentItemWithPlayerItem(playerItem)
    player.play()
It doesn't work. How I can set User Agent in a right way in Swift?
it is really very simple in Swift 2.3
let headerFields: [String:String] = ["User-Agent":"myua"]
let asset: AVURLAsset = AVURLAsset(URL:url!, options: ["AVURLAssetHTTPHeaderFieldsKey": headerFields])
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With