Skip to content

Instantly share code, notes, and snippets.

@kevinejohn
Created October 13, 2011 03:44
Show Gist options
  • Save kevinejohn/1283313 to your computer and use it in GitHub Desktop.
Save kevinejohn/1283313 to your computer and use it in GitHub Desktop.
iOS non-fullscreen video player
#import <MediaPlayer/MediaPlayer.h>
// Add MediaPlayer framework
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(20, 60, 200, 200)];
NSURL *movieUrl = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"];
MPMoviePlayerViewController *player = [[MPMoviePlayerViewController alloc] initWithContentURL:movieUrl];
//player.view.frame = CGRectMake(50, 50, 200, 200);
player.wantsFullScreenLayout = NO;
player.moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
[v addSubview:player.view];
//[self presentMoviePlayerViewControllerAnimated:player];
[player.moviePlayer play];
[self.view addSubview:v];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment