How to pause / resume avplayer preload

I use AVPlayer to play videos from the Internet, is there a way to pause / resume pre-loading the video while playing pause / resume ?

+6
source share
2 answers

One way to do this is to save AVURLAsset in a variable ( tempAsset = player.playerItem.asset ), and then replace playerItem on your player with zero. When you are ready to play it again, you can create a new playerItem from the asset that you saved earlier.

+4
source

I have the same problem and I used a buffer limit to stop preloading in my code. This works for me.

You can also try setting a buffer limit to stop preloading the video when you click Pause or Resume.

Hope this helps you.

+1
source

All Articles