views:

81

answers:

2

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];
    }
}
A: 

Have you tried it on the device? I've heard of the simulator sometimes having this problem when the device is OK.

Mike Howard
have not tried on device yet. does the code look correct? i'm assuming [moviePlayer play] will launch QuickTime, but not sure if that is entirely accurate.
Sheehan Alam
Mike Howard
A: 

i used the view controller instead:

moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:mySTVideo.video_url]];

[self presentModalViewController:moviePlayerViewController animated:YES];

[moviePlayerViewController release];
Sheehan Alam