0

I would like to open the iPad movie player from my app to play a video. The video will already be on the device, and the app is destined to ad-hoc distribution on pre-configured device, thus we can say the video will always be here.

My problem is that I can't figure out how to open the video app! I've searched a lot of things, including UTI, or embedded video, but that doesn't meet my needs.

Is there any way to simply open the player with the specified file ?

4

1 回答 1

3

Do you need to open the video app per se? Or do you just need to play local video file from your app? In the latter case, you can just use MPMoviePlayerController (or the wrapping MPMoviePlayerViewController for iOS > 3.2).

Something like this works for me.

NSURL * url = [[NSBundle mainBundle] URLForResource:@"yourvideo" withExtension:@"mov"];
player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.view.frame = self.view.bounds;
player.movieSourceType = MPMovieSourceTypeFile;

[self.view addSubview:player.view];

player.shouldAutoplay = NO;
player.fullscreen = YES;
[player prepareToPlay];    
于 2011-12-23T15:34:14.687 回答