Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pause/resume avplayer preload

I'm using AVPlayer to play video from Internet, is there a way to pause/resume preloading video when pause/resume playing?

like image 615
xzysun Avatar asked Oct 30 '15 08:10

xzysun


2 Answers

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

like image 123
almas Avatar answered Oct 14 '22 21:10

almas


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

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

I hope this will help you.

like image 1
DJ1 Avatar answered Oct 14 '22 22:10

DJ1