2

我想在 iphone 应用程序中播放视频,我正在使用 MPMoviePlayerController。它曾经工作正常,但突然当我尝试集成播放视频的 viewcontroller 类时,它停止播放。我尝试导入 MediaPlayer 框架并做了很多研发工作,但仍然无法正常工作。我正在使用此代码..

NSURL    *fileURL    =   [NSURL URLWithString:xmlParser.videoUrlLink];
self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayBackDidFinish:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:self.moviePlayerController];
//[moviePlayerController setControlStyle:MPMovieControlStyleEmbedded];
[self.moviePlayerController.view setFrame:CGRectMake(5,65,307,200)];    
[self.view addSubview:self.moviePlayerController.view];
[self.moviePlayerController play];

我收到一条警告,并且即使在播放视频之前,moviePlayBackDidFinish: 方法也会被反复调用。警告是

An instance 0x168da0 of class AVPlayerItem was deallocated while key value observers 
were still registered with it. Observation info was leaked, and may even become 
mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop 
here in the debugger. Here's the current observation info: ( Context: 0x0, Property: 
0x10b570> Context: 0x0, Property: 0x117ab0>

有人可以帮助我如何摆脱这种情况....这将有很大帮助....

4

0 回答 0