ios - MPMoviePlayerController in UIView -


i creating ios ipad application that, among other things, utilizes mpmovieplayercontroller on 1 of screens, underneath view, named "commandmessageview." here relevant parts of .h file:

@interface movieviewcontroller : uiviewcontroller  @property (strong, nonatomic) mpmovieplayercontroller *movieplayer; @property (strong, nonatomic) iboutlet uiview *movieview; @property (strong, nonatomic) iboutlet uiview *commandmessageview; 

and relevant parts of .m file:

@implementation movieviewcontroller  @synthesize movieview; @synthesize movieplayer; @synthesize commandmessageview;  - (void)viewdidload {      [super viewdidload];  // video setup  nsurl *currentvideourl = [nsurl urlwithstring:               self.currentvideo];  movieplayer =  [[mpmovieplayercontroller alloc]                  initwithcontenturl:currentvideourl]; movieplayer.controlstyle = mpmoviecontrolstylenone; movieplayer.scalingmode = mpmoviescalingmodeaspectfit; [movieplayer.view setframe: movieview.bounds]; movieplayer.shouldautoplay = no; [movieview addsubview:movieplayer.view]; [movieplayer preparetoplay];    } 

the video plays fine, except if view rotated portrait, in video placed mid-screen , first 2/3 (horizontally) visible. if helps, screenshots can seen here:

portrait mode landscape mode

what hoping uiview movieview, set autolayout (almost full-screen) define boundary of video fit inside, correct layer (commandmessageview appears on top of it). obviously, off, after tweaking numerous options, haven't made leeway. there obvious missing here/doing wrong, or fix in interface builder can think of? in advance!

not sure how works, adding line:

[movieplayer.view setautoresizingmask:(uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight)]; 

right after

[movieplayer.view setframe: movieview.bounds]; 

got me desired behavior.

happy coding, everyone!


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -