Reputation: 11
I'm trying to preload the first second of a list of playerItems to prevent delay at beginning. I'm using preferredForwardBufferDuration to preload.
Here is a snippet for preload setup:
//setup repload in advance
VURLAsset *asset = [AVURLAsset assetWithURL:m3u8URL];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];
playerItem.preferredForwardBufferDuration = 1;
AVPlayer *player = [[AVPlayer alloc] init];
_playerLayer.player = player;
player.replaceCurrentItemWithPlayerItem(playerItem)
// as soon as playback begins, reset it to 0
_item.preferredForwardBufferDuration = 0;
I have two questions:
Upvotes: 1
Views: 1987
Reputation: 1444
Speeding up playback has several variables to deal with. Take a look on this session https://developer.apple.com/videos/play/wwdc2016/503/ it contains section "Speeding up HTTP Live Streaming" which may be helpful.
Loading time may contains several components e.g. master playlist is too long and it takes time to load it and parse (in this case recommended to setup http compression with gzip on web server) or FairPlay stream encrypted before starts playing. If your stream is video you may also tweak initial quality of video.
Upvotes: 1