我需要将videoplayer放置在opengl层之下,之前在cocos3.3版本做过并解决了这个问题,原来的解决方案可以参考:https://blog.csdn.net/woshiwoxinheqiu/article/details/85691237
现在我们要实用cocos creator开发,我按照之前的经验操作,android原生已经解决,现在ios原生工程实现不了,报错信息如下:
-
Creator 版本:2.1.3
-
目标平台: iOS
-
详细报错信息,包含调用堆栈:
2019-10-16 15:56:27.767849+0800 hello_world-mobile[42116:11637430] Metal GPU Frame Capture Enabled
2019-10-16 15:56:27.768633+0800 hello_world-mobile[42116:11637430] Metal API Validation Enabled
2019-10-16 15:56:27.911204+0800 hello_world-mobile[42116:11637430] failed to call context
2019-10-16 15:56:27.920726+0800 hello_world-mobile[42116:11637430] failed to call context -
重现方式:
AppController.mm文件修改以下代码:UIViewController *videoController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
videoController.view.opaque = YES;
[videoController.view addSubview:_viewController.view];
videoController.view.backgroundColor = [UIColor whiteColor];// Set RootViewController to window
if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn’t work on iOS6
[window addSubview: videoController.view];
}
else
{
// use this method on ios6
[window setRootViewController:videoController];
}