Thursday, 6 November 2014

Play video in iphone sdk (inside a view? Rather than fullscreen)



Import

#import <MediaPlayer/MediaPlayer.h>


NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"Video" ofType:@"mp4"];
    NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
    MPMoviePlayerController *player =[[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    [[player view] setFrame: [self.view bounds]];  // frame must match full screen (or) (10,10,300,250)
    [self.view addSubview: [player view]];

    [player play];

No comments:

Post a Comment