I have an AVPlayerLooper
which uses an AVQueuePlayer
. It's really easy to loop the video, but I wanted to fade in the video during the first second, and fade out during the last second. I've been able to make it fade in and out by using an AVPlayerLayer
and a CABasicAnimation
which animates the opacity appropriately, but I can't make it seamless and 100% reliable. I've tried using NotificationCenter
for the AVPlayerItemDidPlayToEndTime
and AVPlayerItemTimeJumped
. I've also tried using KVO with the key isReadyForDisplay
. When I tried to addPeriodicTimeObserver
, I can't get it accurate enough to correctly time the fades. I've even tried to addBoundaryTimeObserver
, but that wasn't consistent enough either.
Does anybody have any suggestions as to how to implement a crossfade into an AVPlayerLooper/AVQueuePlayer?