How to play video in ios6

I’m confused about:

MPMoviePlayerViewController and MPMoviePlayerController

  • Listing all installed apps on iPhone Programmatically?
  • detect screen unlock events in IOS Swift
  • Notification in Swift every day at a set time?
  • Use AVSpeechSynthesizer on iOS 7 but retain compatibility for iOS 6
  • Hiding objects within UITableViewCell iOS 8 (Swift)
  • How can I add Swipe Gesture to AVPlayer in swift 3
  • what is the best way to play a video locally in ios6?

    this is my code

    NSURL * url = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource: @ "17" OfType: @ "mov"]];
         MoviePlayer = [[MPMoviePlayerViewController alloc]
                         initWithContentURL: url];
         [self presentMoviePlayerViewControllerAnimated: MoviePlayer];
         [moviePlayer.moviePlayer play];
         [[NSNotificationCenter defaultCenter] addObserver: self selector: @ selector (moviePlayerPlaybackStateChanged :) name: MPMoviePlayerPlaybackStateDidChangeNotification object: nil];
    -(void)moviePlayerPlaybackStateChanged:(NSNotification *)notification {

    Solutions Collect From Internet About “How to play video in ios6”

    MPMoviePlayerViewController is for playing fullscreen video and is used mostly on the phone.

    MPMoviePlayerController can be used for embedded video, ie not full screen on any of the iPads. You need to pull an empty view onto your scene in storyboard and give it the desired size. Then, in code, place the movieplayer in that subview. The first part of your code should be in viewDidLoad;

    //movieplayer initialization
    NSString *path = [[NSBundle mainBundle] pathForResource:@"videoName" ofType:@"m4v"];
    NSURL *videoURL = [NSURL fileURLWithPath:path];
    moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
    [moviePlayer setControlStyle:MPMovieControlStyleNone]; // for custom controls, for default controls you can leave this line out.

    This part goes in viewWillAppear;

    moviePlayer.repeatMode = MPMovieRepeatModeOne; // for looping
    [moviePlayer.view setFrame: self.videoSuper.bounds]; 
    [self.videoSuper addSubview: moviePlayer.view];
    [moviePlayer prepareToPlay];
    [moviePlayer play];

    where videoSuper is the subview added in storyboard. Be sure to hook it up correctly;

    //in .h
    @property (weak, nonatomic) IBOutlet UIView *videoSuper;