Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Xcode Tutorial: How to play a Video

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
21,764
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 3, 2009

Here is the code:


NSString *moviePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"video.mp4"];




MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];

moviePlayer.movieControlMode = MPMovieControlModeDefault;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];

[moviePlayer play];



Check out my new website: http://empowereddesignapps.tk

Please Subscribe Rate And Comment!

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 4 dislikes

Link to this comment:

Share to:

Uploader Comments (ipodtouchhelper09)

  • 14 years old!

Top Comments

  • @frankjtc81 i have the same problem, i eneter the code and i only get sound no video? how can i fix this? thanks!

see all

All Comments (38)

Sign In or Sign Up now to post a comment!
  • does this work with a tab bar application?

  • does it support live live streaming?

    

  • 'movieControlMode is deprecated' i get that when i paste the code... what should i do?

  • it will go to the quick time player in the ipod touch the doesnt play

  • part 2:

    tmpMoviePlayViewController.mov­iePlayer.movieSourceType = MPMovieSourceTypeFile; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieView­FinishedCallback:)  name:MPMoviePlayerPlaybackDidF­inishNotification object:tmpMoviePlayViewControl­ler]; [tmpMoviePlayViewController.mo­viePlayer play];

    }

  • part 1:

    - (IBAction)playVideo:(id)sender { NSString *path = [[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"mp4"]; MPMoviePlayerViewController* tmpMoviePlayViewController=[[[­MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]] retain]; [self presentMoviePlayerViewControll­erAnimated:tmpMoviePlayViewCon­troller];

  • I have a lot of problems, can you give me your project ?

  • Hi thank you for the video I tryied and I get an error that i can get rid of tried everything check it out moviePlayer.movieControlMode = MPMovieControlModeDefault; (right here I get movie player undeclared) any thougths thank you

  • How can I repeat the Video?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more