我已经从 UI 的屏幕截图中生成了该 MOV 文件并录制了声音。结合视频和音频并生成 MOV 格式的电影。
我看过很多 MPMoviePlayerViewController 示例,但它只是显示黑屏。我试过 AVPlayer 但我无法让它工作。
我是在 iOS 中播放电影文件的新手,请帮忙。
这是我的代码:
NSString *fileNamePath = mVideo;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *oldappSettingsPath = [documentsDirectory stringByAppendingPathComponent:fileNamePath];
NSURL *path = [NSURL fileURLWithPath:oldappSettingsPath];
self.mPlayer = [[MPMoviePlayerController alloc] initWithContentURL:path];
self.mPlayer.controlStyle = MPMovieControlStyleFullscreen;
self.mPlayer.fullscreen = YES;
self.mPlayer.scalingMode = MPMovieScalingModeFill;
[[self.mPlayer view] setFrame: CGRectMake(0, 0, 480, 320)];
[self.view addSubview:[self.mPlayer view]];
[self.mPlayer prepareToPlay];
[self.mPlayer play];