修改AVPlayer的预加载行为,通过调用“preferredForwardBufferDuration”属性实现。
在Objective-C中:
AVPlayer *player = [AVPlayer playerWithURL:url]; player.currentItem.preferredForwardBufferDuration = 5.0;
在Swift中:
let player = AVPlayer(url: url) player.currentItem?.preferredForwardBufferDuration = 5.0