MacOS 12 beta video playback issue using AVPlayer

Good day community!

I took part in Apple's MacOS 12 beta testing program and faced a problem with AVPlayer + AVPlayerLayer video playback.

System: Macos 12 Beta 5, Xcode 12.5.1

Problem: If application starts in a fullscreen mode, video is not rendering (while audio stream is playing). If I switched to windowed mode (at runtime) video layer becomes visible. This issue does not happen if application starts in windowed mode, there are no problems with video visibility. I can resize, switch fullscreen, switch back - everything works fine. Also there are no problem with video playback on Macos 11.

I provide the simplest application's source code, where one can reproduce the problem.

git clone https://github.com/s-petrovskiy/apple-test

and follow preparation steps in README.md

Steps: 1) Run the program; 2) Switch to fullscreen (by pressing F); 3) Launch video playback (by pressing P); 4) Observe the problem: video layer is not visible while audio is played; 5) Switch back to windowed mode (by pressing F); 6) Observe: video becomes visible.

Alternative: 1) Run the program; 2) Do not switch to fullscreen and launch the video playback (by pressing P); 3) Observe: video is visible; 4) Toggle to fullscreen (by pressing F) or resize the window manually; 5) Observe: everything works fine.

The simplest playback is roughly implemented as following:

  • having a root NSView.
  • create NSView playerView and set it up with wantsLayer:YES; setFrame:[root bounds];
  • add as subview via [root addSubview:playerView];
  • create AVPlayer player;
  • create AVPlayerLayer and init with AVPlayer's instance;
  • set up playerLayer with setAutoresizingMask:kCALayerWidthSizable | lCALayerHeightSizable; setVideoGravityAVLayerVideoGravityResizeAspectFill; setFrame:[videoView bounds];
  • add playerLayer as sublayer to playerView backing layer (which was automatically created by wantsLayer:YES call) via [playerView.layer addSublayer:playerLayer];
  • attach playable asset to player;
  • launch playback as [player play];

I have no problems with video playback on MacOS 11 Big Sur and earlier. Do I miss something in my code or may it be MacOS 12's issue? I have read MacOS 12 release notes but haven't found any API or behaviour changes which may be related to my question.

Any help is highly appreciated. Best regards.

If it worked in macOS 11 but does not work in macOS 12, please file a bug report using the feedback assistant.

MacOS 12 beta video playback issue using AVPlayer
 
 
Q