1
votes

So I have a video being accessed by filepicker.io that is attempting to be played with an MPMoviePlayerController. So far I've tried everything from trying to load the video directly from the FilePicker URL to grabbing the NSData and loading it into the local filesystem. This is my current code, but all that happens is I get a blank screen and the [movieplayer load state] returns 0 (error code). I've verified that the file is there and that it is an MOV filetype.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

 NSString *documentsDirectory = [paths objectAtIndex:0];
 movieString = [documentsDirectory stringByAppendingPathComponent:@"vid.mov"];
 [responseData writeToFile:movieString atomically:YES];  

 NSURL *url = [NSURL fileURLWithPath:movieString];
 MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: url];
 [moviePlayer prepareToPlay];
 [moviePlayer.view setFrame: self.view.bounds];
 [self.view addSubview: moviePlayer.view];
 [moviePlayer play];
1
Try declaring the movie player as an instance variable or property, as there is a bug with it - Chris Loonam
That fixed the problem! Thanks a bunch - Julian Coltea

1 Answers

1
votes

Declaring the movie player as a property fixed the problem. Apparently there's a bug associated with it.