Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMoviePlayerController will not set to the size frame I am declaring

I am currently trying to set the frame for an MPMoviePlayerController which is stored in a custom class (VideoEngine). The movie is set using a URL which is provided by a video which the users capture during the application. (I hope this bit makes sense). I am then setting up the MPMoviePlayerControllers view as follows:

    - (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    //[self.image setImage:[info objectForKey:UIImagePickerControllerMediaURL]];
    videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
    [parentView dismissModalViewControllerAnimated:NO];

    VideoEngine *ve = [[VideoEngine alloc] initWithCallbackName:@"movieFinishedPlaying"];
    [ve loadMovieURL:videoURL];
    [ve.player.view setFrame:CGRectMake((0 + self.frame.size.width * 0.2), self.frame.size.height * 0.3, self.frame.size.width * 0.6, self.frame.size.width * 0.4)];

    CGRect frame = ve.player.view.frame;

    self.video = ve;
    [self addSubview:self.video.player.view];
    [ve release];
}

Firstly, I would like to point out that I know the height values is set using the width but that's to keep it wider then it is high (not fussed about the way this is done at the moment). As you can see I have a pointer to the view's frame so I can check the values (it wouldn't let me access directly using po). Below is a screenshot of the values:

Frame Output

As you can see (just about), the frame is 192 wide x 128 high which is fine. However when I am looking at this within the phone it looks as follows:

Phone Screenshot

The phone has all rotation disabled so it should never be trying to resize in a weird way due to rotation. I am getting really confused by this, so if anyone has any ideas I will be very grateful.

like image 662
Elliott D'Alvarez Avatar asked Nov 27 '22 14:11

Elliott D'Alvarez


2 Answers

Okay, turns out that the MPMovieScaling mode was set to aspect fit, I don't know how I overlooked this but just incase people are running in to the same issue you just need to set this somewhere:

[mpMoviePlayerControllerInstance setScalingMode:MPMovieScalingModeFill];
like image 158
Elliott D'Alvarez Avatar answered Dec 09 '22 17:12

Elliott D'Alvarez


change MPMoviePlayerController as your movie player name

[yourplayername setScalingMode:MPMovieScalingModeFill];

//it fit full frame of the view

like image 31
NANNAV Avatar answered Dec 09 '22 17:12

NANNAV