我正在尝试让我的应用播放已下载到文档目录的视频文件。我知道文件正在下载,但我似乎无法播放文件,这是我的代码:
-(IBAction)play{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"%@/piggy.m4v"];
NSURL *movieURL = [NSURL fileURLWithPath:path];
_player = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[self.view addSubview:_player.view];
_player.controlStyle = MPMovieControlStyleDefault;
_player.shouldAutoplay = YES;
[_player setFullscreen:YES animated:YES];
[_player play];
}