Воспроизведение загруженного видео из каталога документов с помощью Cocoa -Коснитесь

Я пытаюсь заставить свое приложение воспроизводить видеофайл, загруженный в каталог документов. Я знаю, что файл загружается, но я не могу его воспроизвести, вот мой код:

-(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];

}
5
задан Almo 18 July 2012 в 20:01
поделиться