播放视频时显示白屏

时间:2010-12-08 08:45:57

标签: iphone ipad

您好 如果视频不在支持列表中,则会显示白屏。用户无法返回上一个屏幕(导航栏也没有显示) 当我初始化MPMoviePlayerController时,它们的保留计数增加到4。

这是我的代码

mMPMovieViewCont=[[MPMoviePlayerViewController alloc]initWithContentURL:theURL];
        [theURL release];
        theURL=nil;
        [[NSNotificationCenter defaultCenter] addObserver:self 
                                                    selector:@selector(movieDidFinishForOS4:)
                                                         name:MPMoviePlayerPlaybackDidFinishNotification 
                                                       object:nil];

        [self.navigationController presentMoviePlayerViewControllerAnimated:mMPMovieViewCont];
        NSLog(@"%d",[mMPMovieViewCont retainCount]);  //**here count is 4**
- (void) movieDidFinishForOS4:(NSNotification*)notification  {

mMPMovieViewCont.moviePlayer.initialPlaybackTime=-1.0;      
[mMPMovieViewCont dismissMoviePlayerViewControllerAnimated];
[[NSNotificationCenter defaultCenter] removeObserver:self
                                                name:MPMoviePlayerPlaybackDidFinishNotification
                                              object:nil];
NSLog(@"%d",[mMPMovieViewCont retainCount]);  //returning 3

[mMPMovieViewCont release]; 
mMPMovieViewCont = nil;

}

我正在使用ios4.2

1 个答案:

答案 0 :(得分:1)

不要调用retainCount。它在生产中没用,并且误导了调试。

保留计数与您的问题完全无关,看起来如此。我不确定我到底知道“如果视频不在支持列表中, Hi white screen正在显示”是什么意思,但听起来你需要检查视频是否与设备兼容或者在开始播放之前在批准的播放列表上?