非常奇怪的bug!
好的,我用雪碧包创建了一个游戏。
启动时播放视频(MPMoviePlayerController)
一旦视频停止播放,我将使用以下代码来消除它……
- (void) moviePlayBackDidFinish:(NSNotification*)notification {
_moviePlayer = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:_moviePlayer];
if ([_moviePlayer respondsToSelector:@selector(setFullscreen:animated:)])
{
_moviePlayer.fullscreen = NO;
[_moviePlayer.view removeFromSuperview];
}
}一旦视频被删除,它就会显示出游戏。
然而,一旦游戏出现,背景图像看起来模糊或具有低对比度,但随后淡入以在大约2-3秒内看起来正常。
我已经找到了问题的原因……
当我设置的时候
_moviePlayer.controlStyle = MPMovieControlStyleNone;bug就发生了。但是当我设置
_moviePlayer.controlStyle = MPMovieControlStyleFullscreen;很好!!
我不想看到或者有任何控制!..
以前有没有人遇到过这个问题/知道我如何解决这个问题?
提前感谢
丹。
发布于 2014-04-07 22:19:29
您可以使用AVPlayer代替MPMoviePlayerController
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"yourFileName" ofType:@"mp4"];
NSURL *videoURL = [NSURL fileURLWithPath:resourcePath];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:videoURL];
AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];
SKVideoNode *introVideo = [[SKVideoNode alloc] initWithAVPlayer: player];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[player currentItem]];和:
- (void)playerItemDidReachEnd:(NSNotification *)notification {
// Remove AVPlayer, remove Observer...
}https://stackoverflow.com/questions/22892862
复制相似问题