Search code examples
iphoneios5videouiwebviewmpmovieplayercontroller

iPhone app: play video in small view only


In my iPhone App I want to play video in a small view.

Video should start playing automatically, and the buttons for play pause and full screen should be hidden.

enter image description here

How can I achieve that?


Solution

  • What you would do is manually set the frame for MPMoviePlayerController's view, and set the control style to MPMovieControlStyleNone. Much like this below..

    ....
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
    [player setControlStyle:MPMovieControlStyleNone];
    
    //this is where you create your `embedded` view size
    player.view.frame = CGRectMake(0, 0, 200, 300);
    
    [self.view addSubview:player.view];
    ....