gpt4 book ai didi

iphone - 为什么我无法截取 MPMoviePlayerController 的屏幕截图?

转载 作者:行者123 更新时间:2023-12-03 19:43:01 25 4
gpt4 key购买 nike

我需要捕获在 mpmovieplayer Controller 中播放的视频的屏幕截图,但我得到的只是一个红色屏幕(我制作了具有红色背景和 0.5 Alpha 的 coverView)。

这是代码:

NSArray *windows = [[UIApplication sharedApplication] windows];
if ([windows count] > 1)
{
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];


UIView *coverView = [[UIView alloc] initWithFrame:moviePlayerWindow.bounds];
[mainController.moviePlayer pause]; //Without that it won't work either!
coverView.backgroundColor = [UIColor redColor];
coverView.alpha = 0.5;
[moviePlayerWindow addSubview:coverView];

UIGraphicsBeginImageContext(coverView.bounds.size);
[coverView.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *screenShot;

screenShot = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(screenShot, self, nil, nil);
}

有什么想法吗???

谢谢

最佳答案

我对他本人很好奇。我相信对 OpenGL 内容进行屏幕截图也存在类似的问题。

如果您查看这篇博文http://getsetgames.com/2009/07/30/5-ways-to-take-screenshots-of-your-iphone-app/ ,他们有一个适用于 EAGLView 的方法,可能值得为您的问题尝试一下。

关于iphone - 为什么我无法截取 MPMoviePlayerController 的屏幕截图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1859430/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com