iOS13 Beta-8 SKVideoNode+AVPlayer show black screen

233 views Asked by At

my app is a AR app to play h.264 video. We created SKVideoNode by AVPlayer and set the SKVideoNode to SKScene, and then create SCNNode to involve this SKScene.

- Sample Code

AVPlayer *avPlayer = [self getMoviePlayer:path];
SKVideoNode *videoNode = [[SKVideoNode alloc]initWithAVPlayer: avPlayer];

CGSize videoSize = CGSizeMake(100, 50);
videoNode.size = videoSize;

videoNode.position = CGPointMake(50, 50);

videoNode.yScale = -1.0;

SKScene *skScene = [[SKScene alloc] initWithSize:videoSize];
skScene.scaleMode = SKSceneScaleModeAspectFit;

[skScene addChild:videoNode];

SCNNode *planeNode = [[SCNNode alloc] init];
planeNode.geometry =  [[SCNPlane alloc] init];

SCNMaterial *material;
material = [[SCNMaterial alloc] init];

material.diffuse.contents = skScene;
planeNode.geometry.firstMaterial = material;

======================== we use this SCNNode to play videos.

it works fine until iOS12.4 but when I test it on iOS13-beta device, it shows black screen while sound is heard.

2

There are 2 answers

0
Franck-so On

I had the same problem. I solved it with replace:

[myViewController.layer addSublayer:playerViewController.view.layer];

by:

[myViewController addSubview:playerViewController.view];

If it can help you.

0
gplocke On

I had a very similar issue. I also thought it might be an iOS13 bug. But I couldn't reproduce the issue in a test project that was isolating the particular SKVideNode code.

It turned out the root cause of my issue with this problem was in my info.plist file I had PrefersOpenGL set to YES. Changing it to NO (or deleting it) fixed my problem with it not displaying the video in my SKVideoNode iOS 13. It also looks like that change works fine back to iOS 12.4 and 11.4 as well.