Я пытаюсь воспроизвести видео, хранящееся в каталоге документов приложения, через MPMoviePlayerController. Я использую следующий метод для воспроизведения видео:MPMoviePlayerController iO7 issue
NSArray *directoryPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsDir = [directoryPath objectAtIndex:0];
int videoNumber = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"videoSaved"];
NSString* videoName = [NSString stringWithFormat:@"video-%d.mov",videoNumber];
NSString *exportPath = [docsDir stringByAppendingPathComponent:videoName];
NSURL *exportUrl = [NSURL fileURLWithPath:exportPath isDirectory:NO];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:exportUrl];
moviePlayer.fullscreen = YES;
moviePlayer.view.frame = self.view.bounds;
[self.view addSubview:moviePlayer.view];
[moviePlayer prepareToPlay];
[moviePlayer play];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieDidExitFullscreen:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
Он отлично работает на всех версиях IOS, кроме iOS7. В iOS7, когда я пытаюсь играть видео он Ives мне эту ошибку:
_itemFailedToPlayToEnd: { kind = 1; new = 2; old = 0;}
@IronManGill вы можете увидеть, я уже пользователь ** fileURLWithPath ** в ** exportURL ** –
Попробуйте NSLog exportUrl – Mutawe
@Mutawe да, он дает мне URL-адрес корнера : file: /// var/mobile/Applications/696925E2-BA2E-4359-AA81-41D98AA594DB/Documents/video- 8.mov –