views:

103

answers:

1

I have added an imageView of size 300*300 into the interface in my ipad project. I can play the video fullscreen using MPMOviePlayerController. And I am trying to make it play in the imageView by using the following code.

[imageView1 addSubview:moviePlayer.view];
[self.moviePlayer play];

Its playing but not as fullscreen and also not filling the whole imageview. Its kind of playing on the top quarter of the view and that too not the whole movie view - about lower right 60% only.

How can I fix this? How can I make the movie play on the whole imageview like it plays on the full screen?

A: 

Ok, I got it. Just change the frame. When I press the button to play, I call a function. And there will be a view in which you want to play this video. So just add the moviePlayer's view into this view.

MPMoviePlayer *mvPl;//
// do all the code for setting the video and all other things.

//
self.moviePlayer = mvPl;
[self.smallView addSubView:moviePlayer.view];
[moviePlayer.view setFrame:CGRectMake(0.00, 0.00, smallView.frame.size.width,
smallView.frame.size.height)];//now the moviePlayer has its own view for which
//we have to set the frame like anyother subView inside a superView.

[moviePlayer play];

So it will fill the whole subView and will play the video in that subView. Along with that play/pause and enlarge into fullscreen buttons will be there.

wolverine
Can you post the solution? I am trying to the same thing and I don't get it how... thx
amok
Just only saw your comment. I have given the code, if any doubts ask me. If I can, I will provide.
wolverine
instead of [moviePlayer.view setFrame:CGRectMake(0.00, 0.00, smallView.frame.size.width,smallView.frame.size.height)]; you can simply use bounds of smallView: [moviePlayer.view setFrame:smallView.bounds];
e40pud