Get “[SceneKit] Error:” when set AVPlayer to SCNMaterial.diffuse.contents

匿名 (未验证) 提交于 2019-12-03 01:33:01

问题:

According Apple's docs, SCNMaterial.diffuse.contents can be a AVPlayer. In this case material appear content of video.

Everything seems ok but I get several sceneKit error logs:

 [SceneKit] Error: Could not get pixel buffer (CVPixelBufferRef) 

Below is my code. Move [_player play] to viewWillAppear does't help.

- (void)viewDidLoad {     [super viewDidLoad];     self.boxNode = [self.sceneView.scene.rootNode childNodeWithName:@"box" recursively:YES];     NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/VRF_SuLie.MP4"];     AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:path]];     AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:asset];     _player = [AVPlayer playerWithPlayerItem:item];     self.boxNode.geometry.firstMaterial.diffuse.contents = _player; } -(void)viewDidAppear:(BOOL)animated{     [super viewDidAppear:animated];     [_player play]; } 

How to avoid this error?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!