我有在我的应用程序中记录屏幕的代码,然后我希望能够回放它。我已经用倒带,播放和快进按钮进入黑色加载屏幕,但它在加载时挂起,没有播放任何内容。
此代码播放剪辑:
-(IBAction)playMovie:(id)sender
{
MPMoviePlayerViewController *movieViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:locationOfVideoURL];
movieViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[self presentMoviePlayerViewControllerAnimated:movieViewController];
}
我相信这个问题与 locationOfVideoURL 变量有关。我能够打印它,它似乎应该工作。
这里打印出来:
file://localhost/Users/myusername/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/[遗漏,个人信息]/Documents/Videoclip.mp4
有任何想法吗?任何帮助将不胜感激!谢谢你
编辑:视频剪辑的位置:
NSString *outputPath = [[NSString alloc] initWithFormat:@"%@/%@", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0], @"Videoclip.mp4"];
NSURL *outputURL = [[NSURL alloc] initFileURLWithPath:outputPath];
NSLog(@"Completed recording, file is stored at: %@", outputURL);