J'essaie de charger une vidéo sur le Web, mais j'ai du mal à la faire apparaître dans QuickTime. Je peux seulement entendre l'audio. Je voudrais le lancer QuickTime.Comment lancer QuickTime à partir de mon application?
- (void)loadView {
NSURL *movieURL = [NSURL URLWithString:@"http://movies.apple.com/media/us/mac/getamac/2009/apple-mvp-biohazard_suit-us-20090419_480x272.mov"];
if (movieURL != nil) {
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
moviePlayer.initialPlaybackTime = -1.0;
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerScalingModeDidChangeNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(endPlay:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
moviePlayer.movieControlMode = MPMovieControlModeDefault;
moviePlayer.backgroundColor = [UIColor blackColor];
[moviePlayer play];
}
}
n'ont pas encore essayé sur l'appareil. le code a-t-il l'air correct? Je suppose que [moviePlayer play] lancera QuickTime, mais je ne sais pas si c'est tout à fait exact. –
Cela semble correct, mais je ne suis pas un gourou MPMoviePlayerController. Je vais certainement prendre un appareil et le vérifier si. – DenverCoder9