Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 如何拍摄AVPlayer正在播放的UIView屏幕截图?_Swift_Opengl_Avplayer_Screen Recording - Fatal编程技术网

Swift 如何拍摄AVPlayer正在播放的UIView屏幕截图?

Swift 如何拍摄AVPlayer正在播放的UIView屏幕截图?,swift,opengl,avplayer,screen-recording,Swift,Opengl,Avplayer,Screen Recording,我正在尝试从特定UIVIew的截图生成视频。这个视图有一个AVPlayer子视图和一个canvas子视图(我们可以在其中绘制形状)。刚刚尝试了从CurrentImageContext获取UIGraphicsGetImageFromCurrentImageContext的正常方式,屏幕截图是黑色的。我想这是因为视频是用GPU渲染的 所以我试着拍摄一个GLKView的屏幕截图,上面的两个子视图被添加到这个GLKView中。但它仍然将GLKView背景颜色作为图像。为了我的目的,参考了下面的两个链接

我正在尝试从特定UIVIew的截图生成视频。这个视图有一个AVPlayer子视图和一个canvas子视图(我们可以在其中绘制形状)。刚刚尝试了从CurrentImageContext获取UIGraphicsGetImageFromCurrentImageContext的正常方式,屏幕截图是黑色的。我想这是因为视频是用GPU渲染的

所以我试着拍摄一个GLKView的屏幕截图,上面的两个子视图被添加到这个GLKView中。但它仍然将GLKView背景颜色作为图像。为了我的目的,参考了下面的两个链接

我走对了吗?如果是,请帮助我了解我缺少什么。 或 还有其他更好的方法吗?AvassetimageGenerator根本不适合我的要求,所以我也不能使用它

AvassetimageGenerator根本不适合我的要求,因此 我也不能用它

原因是什么我不知道,但通过使用AvassetimageGenerator,可以拍摄视频快照并在屏幕快照图像上绘制快照图像,这很容易,因为您知道黑色部分的框架

请参阅下面的文章,将UIImage置于另一个UIImage之上