iphone - ios MPMoviePlayerController 无法在模拟器上播放本地文件
<p><p>我是新来的。我已经浏览了 2 天的解决方案,但不满意。</p>
<p>这是我的代码:</p>
<pre><code>NSString *docPath = ;
NSString *docaPathFull = ;
self.videoURL = ;
MPMoviePlayerController *player = [ initWithContentURL:videoURL];
UIImage*thumbnail = ;
player = nil;
self.imageView.image = thumbnail;
</code></pre>
<p>问题是,我无法使 MPMoviePlayerController 的视频文件可见。我无法获得缩略图,也无法播放,只有黑色播放器和无限加载。 </p>
<p>我试过了:</p>
<pre><code>NSString*thePath=[ pathForResource:@"IMG_0003" ofType:@"m4v"];
self.videoURLtheurl=;
</code></pre>
<p>还有这个</p>
<pre><code>self.videoURL = [ URLForResource:@"IMG_0005" withExtension:@"mov"];
</code></pre>
<p>还有这个</p>
<pre><code>NSString *filePath = @"/Users//Documents/video/IMG_0004.mov";
self.videoURL = ;
</code></pre>
<p>如果你有任何想法如何拯救我的生命,请做!!!</p>
<p>非常感谢您的宝贵时间。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>实际上,这是我项目中的工作示例。确保将 m4v 文件添加到项目中。通知对我来说是需要的,也许对你来说没有必要。</p>
<pre><code>theMovie = [ initWithContentURL:
pathForResource:@"yourmovie" ofType:@"m4v"]]];
theMovie.view.frame = CGRectMake(0, 0, 320, 480);
;
[ addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:theMovie];
;
;
</code></pre></p>
<p style="font-size: 20px;">关于iphone - ios MPMoviePlayerController 无法在模拟器上播放本地文件,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/16340021/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/16340021/
</a>
</p>
页:
[1]