【发布时间】:2023-09-25 00:29:01
【问题描述】:
我正在做识别 2D 图像的 IOS 应用程序。识别后,它使用以下代码覆盖具有读取背景的区域:
SCNPlane *plane = [SCNPlane planeWithWidth:width height:height];
plane.firstMaterial.diffuse.contents = [UIColor redColor];
现在我希望它在检测到的区域内播放视频。我使用以下方法创建了 AVPlayer 对象:
NSURL *url = [[NSBundle mainBundle] URLForResource:@"IMG_2099" withExtension:@"MOV"];
AVPlayer *player = [AVPlayer playerWithURL:url];
并将播放器添加到材质中,将 redColor 替换为:
plane.firstMaterial.diffuse.contents = player;
我想我需要做一些其他事情才能让 AVPlayer 播放。我应该在代码中添加什么(目标 c)?
【问题讨论】: