It feels like this should be somewhere here on SO. However I can’t find it…
I’m trying to use an MPMoviePlayerController, but the problem is that exactly nothing happens. I don’t even get an error…
Here’s some code:
NSURL *movieUrl = [NSURL URLWithString:[attachmentDictionary objectForKey:@"Uri"]];
NSLog(@"URI %@", movieUrl);
MPMoviePlayerController *mediaController = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];
[mediaController prepareToPlay];
[mediaController.view setFrame:self.view.bounds];
[self.view addSubview:mediaController.view];
[mediaController play];
I have included the MediaPlayer Framework, and MediaPlayer/MediaPlayer.h.
Do you have any idea of what might be wrong?
EDIT:
Found out that I get this error code:
2012-09-28 09:45:57.346 Famorable[178:907] [MPAVController] Autoplay: Disabling autoplay for pause
2012-09-28 09:45:57.348 Famorable[178:907] [MPAVController] Autoplay: Disabling autoplay
2012-09-28 09:45:57.435 Famorable[178:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
I got it!
It’s the ARC spooking again by releasing the MPMoviePlayerController before it played… By declaring the property in the header file you’re good to go!