How can I launch QuickTime from my app?

Posted by Sheehan Alam on Stack Overflow See other posts from Stack Overflow or by Sheehan Alam
Published on 2010-06-10T21:40:00Z Indexed on 2010/06/10 21:42 UTC
Read the original article Hit count: 308

I am trying to load a video from the web, but am having trouble getting it to appear in QuickTime. I can only hear the audio. I would like it to launch QuickTime.

- (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];
    }
}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c