AVPlayer播放视频链接修改请求头

2018-08-20  本文已影响0人  小汐_challenge

AVPlayer播放视频链接修改请求头

NSMutableDictionary* headers = [NSMutableDictionarydictionary];[headers setObject:@"YourHeader"forKey:@"User-Agent"];self.urlAsset = [AVURLAssetURLAssetWithURL:self.videoURL options:@{@"AVURLAssetHTTPHeaderFieldsKey": headers}];// 初始化playerItemself.playerItem = [AVPlayerItemplayerItemWithAsset:self.urlAsset];self.player = [AVPlayerplayerWithPlayerItem:self.playerItem];

上一篇 下一篇

猜你喜欢

热点阅读