SCNMaterialProperty不渲染图层

时间:2014-10-02 01:42:01

标签: ios avfoundation scenekit

SCNMaterial上的SCNMaterialProperty的contents属性在分配AVPlayerLayer时无法呈现。 请注意,这只是物理设备上的问题,在模拟器上运行正常(Xcode 6.0.1)。

我正在创建我的SCNode:

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];

我正在创建视频图层:

- (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;
}

所以这在模拟器中工作正常。但是在运行iOS 8.0.2的iPhone 6上,我可以听到音频,但节点是不可见的。

这是一个错误还是我做错了什么?

0 个答案:

没有答案