Rit*_*ika 25 video objective-c mpmovieplayercontroller ios
我用MPMoviePlayerController我在我的Application Document文件夹中播放一个本地文件,我已经下载了服务器URL:
itemMoviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[self.view addSubview:itemMoviePlayerController.view];
itemMoviePlayerController.fullscreen = YES;
itemMoviePlayerController.movieSourceType = MPMovieSourceTypeFile;
itemMoviePlayerController.initialPlaybackTime = -1.0;
[itemMoviePlayerController play];
Run Code Online (Sandbox Code Playgroud)
当我.mov下载文件后播放文件时,它显示一个黑色的空白屏幕,应用程序UI无法使用.但是如果下次播放相同的本地文件,它可以正常播放.我甚至验证playState及localState为MPMoviePlayerController他们似乎罚款.什么可能是黑色空屏幕的原因?
dul*_*gan 15
你可以试着把它放在[itemMoviePlayerController prepareToPlay];
前面[itemMoviePlayerController play];
Apple首选显示全屏视频的方式是呈现模式MPMoviePlayerViewController(如Hollance所说).要呈现它,你应该使用类似的东西:
moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];
[itemMoviePlayerController play];
Run Code Online (Sandbox Code Playgroud)
您可以在那里阅读,您应该保留对您的引用MPMoviePlayerViewController ,以便稍后将其解雇
[self dismissMoviePlayerViewControllerAnimated:moviePlayerViewController].
mat*_*sed 13
我把它固定了
@property (strong, nonatomic) MPMoviePlayerController *moviePlayer;
Run Code Online (Sandbox Code Playgroud)
在我的.h文件中,并调用self.moviePlayer我的所有代码,它工作!
| 归档时间: |
|
| 查看次数: |
23037 次 |
| 最近记录: |