AVPlayerLayer sometimes doesn't render video in iOS 10

Hi,

I've been investigating an issue where AVPlayerLayer doesn't render the video(audio only) occasionally, but if you pause the video and wait for 5 sec then play again, the video comes back...

I'm debugging on on iPhone 5s with iOS 10.0.1 (14A403).

I implemented AVPlayer like this:


     AVPlayer *player = [AVPlayer playerWithURL:url];

     [player play];

     AVPlayerLayer *layer = [AVPlayerLayer layer];

     layer.player = player;

     layer.frame = CGRectMake(0, 0, 300, 300);

     [self.view.layer addSublayer:layer];


And the issue NEVER HAPPEDNS on iOS 10 simulator and the same code also works fine on iOS 9 (both device and simulator).

Does anyone know if there is any other change in iOS 10 that I need to make?

Thanks in advance.

Is there anyone who has fixed this problem with workaroud? Stucked here for weeks.


Appreciate that someone could give me an answer!

Facing the exact same issue. Have you been able to resolve this and how?

Happened to me when timeRange of audio track was longer than video track in AVMutableCompostion.

Same issue. I am using exportAsynchronouslyWithCompletionHandler to export video and AVVideoCompositionCoreAnimationTool to add water mark. But I havn't meet the issue in iOS 10.3 and later.

I found a solution to workaround. I used GPUImageFilter to render the watermark on the video. The GPUimageMovieCompostion will be use to composite video.

AVPlayerLayer sometimes doesn't render video in iOS 10
 
 
Q