MPMoviePlayerViewController 在 -[ES1Renderer resizeFromLayer:] 中崩溃 OpenGL 错误 0x0505
我遇到一个问题,在 IOS 应用程序启动时加载介绍影片时,游戏将崩溃,并出现 -[ES1Renderer resizeFromLayer:] 中的 OpenGL 错误 0x0505。
我的电影规格是:
尺寸:480 x 320 编解码器:H.264、AAC 持续时间:00:15 总比特率:984 大小:1.9 MB
我在 applicationDidFinishLaunching 上启动电影,并在电影播放完毕后调用的单独方法中进行 CCDirector 和 EAGLView 初始化/创建。
这适用于模拟器以及 Iphone 4、3GS、Ipod 4th Gen,但在 Ipod 2nd gen(版本 4.1)上它会崩溃。
我有自己的类,该类派生自 MPMoviePlayerViewController,并且有自己的名为 startMovie 的方法,该方法执行以下操作:
- (void)startMovie
{
MPMoviePlayerController* moviePlayerController = [self moviePlayer];
moviePlayerController.controlStyle = MPMovieControlStyleNone;
moviePlayerController.useApplicationAudioSession = YES;
moviePlayerController.fullscreen = YES;
moviePlayerController.scalingMode = MPMovieScalingModeAspectFill;
// Only play video for iOS above 3.2
if(OS_Version > 3.21)
{
[moviePlayerController setMovieControlMode:MPMovieControlModeHidden];
[moviePlayerController prepareToPlay];
[moviePlayerController play];
}
else
{
// Use the new 3.2 style API
if([moviePlayerController respondsToSelector:@selector(setFullscreen:animated:)])
moviePlayerController.shouldAutoplay = YES;
else // Use the old 2.0 style API
{
moviePlayerController.movieControlMode = MPMovieControlModeHidden;
[moviePlayerController play];
}
}
}
当启动我的电影时,我会这样做:
self.moviePlayerViewController = [[[PFMPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:filePath]] autorelease];
[moviePlayerViewController startMovie];
我相信我的内存不足,因为 OpenGL 错误 0x0505 是内存不足问题,但我不明白为什么。点击播放按钮后,游戏本身分配了超过 2 MB 的空间,所以我认为它可以处理电影分配。
我可能做了什么明显错误的事情导致 OpenGL 抛出这样的错误吗?
谢谢,
I am having an issue where when loading an intro movie at the start of my IOS application, the game will crash with OpenGL error 0x0505 in -[ES1Renderer resizeFromLayer:].
My movie specs are:
Dimensions: 480 x 320
Codecs: H.264, AAC
Duration: 00:15
Total bit rate: 984
Size: 1.9 MB
I start the movie on applicationDidFinishLaunching and do my CCDirector and EAGLView initialization/creation in a separate method which gets called after the movie finishes playing.
This works on simulator as well as Iphone 4, 3GS, Ipod 4th Gen, but on Ipod 2nd gen (Version 4.1) it crashes.
I have my own class that is derived from MPMoviePlayerViewController and have my own method called startMovie which does this:
- (void)startMovie
{
MPMoviePlayerController* moviePlayerController = [self moviePlayer];
moviePlayerController.controlStyle = MPMovieControlStyleNone;
moviePlayerController.useApplicationAudioSession = YES;
moviePlayerController.fullscreen = YES;
moviePlayerController.scalingMode = MPMovieScalingModeAspectFill;
// Only play video for iOS above 3.2
if(OS_Version > 3.21)
{
[moviePlayerController setMovieControlMode:MPMovieControlModeHidden];
[moviePlayerController prepareToPlay];
[moviePlayerController play];
}
else
{
// Use the new 3.2 style API
if([moviePlayerController respondsToSelector:@selector(setFullscreen:animated:)])
moviePlayerController.shouldAutoplay = YES;
else // Use the old 2.0 style API
{
moviePlayerController.movieControlMode = MPMovieControlModeHidden;
[moviePlayerController play];
}
}
}
When starting my movie I do is like so:
self.moviePlayerViewController = [[[PFMPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:filePath]] autorelease];
[moviePlayerViewController startMovie];
I believe I am running out of memory since the OpenGL error 0x0505 is an out of memory issue, but I don't under stand why. The game itself allocated more than 2 MB after hitting the play button, so I would think it could handle the movie allocation.
Is there anything glaringly wrong that I may be doing to cause OpenGL to throw an error like this?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您最好使用 CCVideoPlayer 类 cocos2d-iphone-extensions 项目,而不是重新发明轮子。
You'll be better off using the CCVideoPlayer class from the cocos2d-iphone-extensions project, rather than re-inventing the wheel.