The SCNMaterialProperty content property in SCNMaterial cannot be displayed when assigning AVPlayerLayer. Please note that this is only a problem on the physical device, it works fine on the simulator (Xcode 6.0.1).
I create my SCNode as such:
SCNNode *videoBall = [SCNNode node];
videoBall.position = SCNVector3Make(-5, 5, -18);
videoBall.geometry = [SCNSphere sphereWithRadius:5];
videoBall.geometry.firstMaterial.locksAmbientWithDiffuse = YES;
videoBall.geometry.firstMaterial.diffuse.contents = [self videoLayer];
videoBall.geometry.firstMaterial.diffuse.contentsTransform = SCNMatrix4MakeScale(2, 1, 1);
videoBall.geometry.firstMaterial.diffuse.wrapS = SCNWrapModeMirror;
[[scene rootNode] addChildNode:videoBall];
I am creating a video layer as such:
- (AVPlayerLayer *)videoLayer {
if (_videoLayer == nil) {
AVPlayer *player = [AVPlayer playerWithURL:[NSURL URLWithString:@"http://devstreaming.apple.com/videos/wwdc/2014/609xxkxq1v95fju/609/609_sd_whats_new_in_scenekit.mov"]];
_videoLayer = [AVPlayerLayer layer];
[_videoLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
_videoLayer.frame = CGRectMake(0, 0, 1000, 1000);
_videoLayer.player = player;
[player play];
}
return _videoLayer;
}
So this works great in a simulator. However, on iPhone 6 running iOS 8.0.2, I hear sound, but node is invisible.
Is this a mistake or am I doing something wrong?
source
share