我想在iphone应用中播放视频,我正在使用MPMoviePlayerController。它过去工作正常但突然当我试图集成播放视频的viewcontroller类时,它停止播放。我试图导入MediaPlayer框架并做了很多R& D的东西,但仍然无法正常工作。我正在使用此代码..
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>
有人可以帮助我解决这个问题......这会有很大的帮助......