I am trying to eliminate some Main Thread performance hits that occur when I allocate AVPlayer, AVPlayerItem and AVURLAsset on the main thread. Has anyone had experience with moving allocation/releasing of these objects to a background thread? Similarly, can an AVPlayer's currentItem be set on a background queue?
The following will definitely hurt scrolling performance
I tried with allocate AVPlayer from a background thread, however, AVFoundation will switch back to main and perform the allocation/initialization from main. Same with play/pause.
I have some success with deallocating AVPlayer/AVPlayerItem on a background thread. Basically you need to clear out last reference to AVPlayer from your background thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With