ios - 在 iphone 中单击完成按钮时,MP 电影 Controller 会删除
<p><p>我在 MPmovieController 中播放视频它工作正常,但播放完整视频时播放器会移除。我希望当用户按下完成按钮时视频应该停止在这里是我正在使用的代码。</p>
<pre><code> NSURL*myURL=;
MPMoviePlayerController *moviePlayerController = [ initWithContentURL:myURL];
[ addObserver:self
selector:@selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
;
;
;
- (void)moviePlaybackComplete:(NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = ;
[ removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];
;
;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>试试这个:</p>
<pre><code> NSURL *fileURL= valueForKey:@"VideoUrl"]];
self.mpPlayer = [ initWithContentURL:fileURL];
;
;
self.mpPlayer.moviePlayer.shouldAutoplay=NO;
;
- (void)moviePlayBackDidFinish:(NSNotification*)notification
{
MPMoviePlayerController *moviePlayer = ;
[ removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
;
;
// ;
}
</code></pre>
<p>也许会有所帮助。</p>
<p>愉快的编码...</p></p>
<p style="font-size: 20px;">关于ios - 在 iphone 中单击完成按钮时,MP 电影 Controller 会删除,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/20088584/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/20088584/
</a>
</p>
页:
[1]