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:
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:
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.
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];
change MPMoviePlayerController as your movie player name
[yourplayername setScalingMode:MPMovieScalingModeFill];
//it fit full frame of the view
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With