ios - MPMoviePlayerController 5s 后停止播放视频
<p><p>我尝试在 iOS 中播放视频,但任何视频都只能播放 5 秒。这是我的代码:</p>
<pre><code>NSBundle *bundle = ;
NSString *moviePath = ;
NSURL *movieURL = [initFileURLWithPath:moviePath];
MPMoviePlayerController *theMoviPlayer = [ initWithContentURL:movieURL];
theMoviPlayer.controlStyle = MPMovieControlStyleFullscreen;
theMoviPlayer.controlStyle = MPMovieControlStyleDefault;
;
theMoviPlayer.shouldAutoplay = YES;
theMoviPlayer.view.transform = CGAffineTransformConcat(theMoviPlayer.view.transform, CGAffineTransformMakeRotation(M_PI_2));
;
;
;
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>声明一个 ivar <code>@property (nonatomic,strong) MPMoviePlayerController *myMovieController;</code></p>
<p>将MoviPlayer分配给它,如下所示,</p>
<pre><code>self.myMovieController = theMoviPlayer;
;
</code></pre>
<p>然后播放电影。</p>
<p>问题似乎是 <code>theMoviPlayer</code> 没有保留。</p></p>
<p style="font-size: 20px;">关于ios - MPMoviePlayerController 5s 后停止播放视频,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/22219227/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/22219227/
</a>
</p>
页:
[1]