ios - Issue while playing video in full screen mode using MPMoviePlayerViewController -
i have problem while playing video in full screen mode using mpmovieplayerviewcontroller (works in normal mode).
code:
if (playv) { self.previewview.hidden=no; self.videocontroller =[[mpmovieplayercontroller alloc] initwithcontenturl:self.videourl]; [self.videocontroller.view setframe:self.previewview .frame]; self.videocontroller.view.center=self.playbtn.center; [self.previewview addsubview:self.videocontroller.view]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(videoplaybackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:self.videocontroller]; self.videocontroller.scalingmode = mpmoviescalingmodeaspectfit; self.videocontroller.controlstyle = mpmoviecontrolstylenone; [self.videocontroller play]; }
i got solution - hope others well.
add line of code in playbtnaction method:
- (ibaction)playbtnaction:(id)sender { [self.videocontroller setfullscreen:yes animated:yes]; } and add line of code in videoplaybackdidfinish.
mpmovieplayercontroller *player=[notification object]; if ([player respondstoselector:@selector(setfullscreen:animated:)]) { [player.view removefromsuperview]; } this code check if video in fullscreen mode , bring normal mode.
Comments
Post a Comment