0
几秒钟后崩溃
我用它来播放视频的方法是:影片开始,但与MPMoviePlayerViewController
-(void)playVideo:(NSString*)title {
NSLog(@"NAME: %@", title);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *moviePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp4", title]];
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
mp.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
[self presentMoviePlayerViewControllerAnimated:mp];
[mp release];
}
约4秒或5秒的视频停止后,先前的屏幕显示和我得到以下错误:
_itemFailedToPlayToEnd: {
AVPlayerItemFailedToPlayToEndTimeErrorKey = "Error Domain=AVFoundationErrorDomain Code=-11800 \"The operation could not be completed\" UserInfo=0xb19a220 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0xb17fac0 \"The operation couldn\U2019t be completed. (OSStatus error -12551.)\", NSLocalizedFailureReason=An unknown error occurred (-12551)}";
原来我尝试播放已损坏的视频,我会检查这个第一下一次。 – Jack