ios - SceneKit AVPlayer 仅播放音频
问题描述
我正在尝试播放视频SceneKit
。我可以听到音频但视频未呈现。我使用场景的方式如下。请帮忙。
SCNScene *scene = [SCNScene sceneNamed:@"art.scnassets/plane.scn"];
SCNNode *plane = [scene.rootNode childNodeWithName:@"plane" recursively:YES];
AVPlayer *player = [AVPlayer playerWithURL:[NSURL URLWithString:@"https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_5mb.mp4"]];
plane.geometry.firstMaterial.diffuse.contents = player;
[player play];
SCNView *scnView = (SCNView *)self.view;
scnView.scene = scene;
scnView.allowsCameraControl = YES;
scnView.showsStatistics = YES;
scnView.backgroundColor = [UIColor blackColor];
解决方案
您需要使用真正的 iPhone 而不是模拟器才能享受。
另一个原因是材质面板中的阴影不应该是基于物理的。你可以试试布林。代码没有问题。
如果使用基于物理的,则必须添加额外的灯光才能使其工作。
推荐阅读
- python - 如何找出图像的平均像素值,从顶部和底部扫描它?
- javascript - 如何使用javascript更改导航元素内多级手风琴菜单的子菜单的背景颜色
- python - 在仅限容器的开发环境之外运行 django `makemigrations` 的体面做法是什么
- python - Music21 乐器对象未按预期工作
- c# - 获取动态加载程序集的异常行号
- python - 如何通过单击当前图形来调用另一个图形
- vb.net - 如何在数据网格视图中按名称对单元格值求和?
- dialogflow-es - DialogFlow Fulfillment - 如何获取参数的原始值和默认值
- c# - 使用 RazorLightEngine 在 .cshtml 剃须刀模板中使用本地化
- r - Python 或 R 中的 MSapriori 和 CARapriori 算法实现