我有代码记录我的应用程序中的屏幕,然后我希望能够播放它。我已经到了带有倒带,播放和快进按钮的黑色加载屏幕,但它在装载时挂起而没有播放任何东西。
此代码播放剪辑:
- (IBAction为)的playMovie:(ID)发送方
{
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/ [left out,personal info] /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);