以下是我用来播放HLS内容的代码
let url = URL(string: "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8")
let playerItem = AVPlayerItem.init(url: url)
playerItem.preferredPeakBitRate = 20000
let player = AVPlayer.init(playerItem: playerItem)
let controller = AVPlayerViewController()
controller.player = player
present(controller, animated: true) {
player.play()
}
但是在日志中,我可以看到所使用的比特率约为25000,但我将preferredPeakBitRate设置为20000。
答案 0 :(得分:0)
在preferredPeakBitRate documentation中,显示以下消息:
如果无法降低网络带宽消耗以达到PreferredPeakBitRate,则在继续播放该项目时会尽可能降低它。