SCNMaterialProperty's contents property on SCNMaterial is unable to render when assigned a AVPlayerLayer. Note this is only a issue on a physical device, works fine on the simulator (Xcode 6.0.1).
I am creating 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 the 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 fine in the simulator. However on a iPhone 6 running iOS 8.0.2, I can hear the audio but the node is invisible.
Is this a bug or am I doing something wrong?