I am using AVPlayer to play videos. The lenght of them is short, 2-5 second. They are played in a random order. The problem is, when changing video, and a new video starts to play, the device lags for a very short time, but i wan't the change to be fluid. Is there a way to preload videos with AVPlayer?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- How to create a MediaClip from RenderTargetBitmap
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- Safari blocks play() on video despite being called
- How do you detect key up / key down events from a
Try using
AVQueuePlayer
. I am assuming that what you described as a lag, in fact is the pre buffering delay. This should be minimized or actually entirely be gotten rid of when usingAVQueuePlayer
as that baby will buffer the nextAVPlayerItem
while playing the current one.From the AVFoundation documentation:
Also see Mihai's answer on Pre-buffering-for-avqueueplayer.