3

here i want to play a youtube video using mediaplayer framework.For this i follow this process, 1)I am adding mediaplayer framework. 2)I am importing #import header file 3)I implemented code by using google

But it shows thread ,

Can any one tell me how to solve this problem.

4

2 に答える 2

1

これをチェックしてください:

http://mobile.tutsplus.com/tutorials/iphone/iphone-sdk-playing-video-with-the-mediaplayer-framework/ 同様にこのスレッドをチェックしてください: mpplayerを使用してURLからビデオを再生する方法は?

于 2013-03-04T07:47:33.970 に答える
1

これを試してみてください..これはあなたの助けになると思います。

- (IBAction)playVideo:(id)sender
{    
    NSURL *videosURL = [NSURL URLWithString:@"YourVideoURL"];
    MPMoviePlayerController *moviePlayController = [[MPMoviePlayerController alloc]initWithContentURL:videosURL];
    [self.view addSubview:moviePlayController.view];

    [moviePlayController prepareToPlay];
    moviePlayController.controlStyle = MPMovieControlStyleDefault;
    moviePlayController.shouldAutoplay = YES;
    [moviePlayController setFullscreen:YES animated:YES];
}

- (void) moviePlayBackDidFinish:(NSNotification*)notification
{

    MPMoviePlayerController *player = [notification object];

    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:MPMoviePlayerPlaybackDidFinishNotification object:player];

    if ([player respondsToSelector:@selector(setFullscreen:animated:)])
    {
        [player.view removeFromSuperview];
    }
}
于 2013-03-04T07:48:58.710 に答える