MPMoviePlayerController:无法从全屏切换到嵌入式
Posted
技术标签:
【中文标题】MPMoviePlayerController:无法从全屏切换到嵌入式【英文标题】:MPMoviePlayerController: unable to switch from fullscreen to embedded 【发布时间】:2011-09-19 06:36:59 【问题描述】:我有一个带有嵌入视频的纵向视图。将方向更改为横向时,MPMovieplayerController 成功切换到全屏,但当更改回纵向时,它仍处于全屏模式。导航栏为旋转动画闪烁,但视频保持(纵向)全屏模式。
我错过了什么吗?
- (void)viewDidAppear:(BOOL)animated
[super viewDidAppear:animated];
m_player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:self.selectedVideo.videoHighURL ]];
m_player.scalingMode = MPMovieScalingModeAspectFit;
m_player.controlStyle = MPMovieControlStyleFullscreen;
m_player.view.frame = m_videoView.frame;
[m_videoView addSubview:m_player.view];
[m_player play];
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
switch (toInterfaceOrientation)
case UIInterfaceOrientationPortraitUpsideDown:
break;
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
if (NO == m_player.fullscreen)
[m_player setFullscreen:YES animated:YES];
break;
case UIInterfaceOrientationPortrait:
[m_player setFullscreen:NO animated:YES];
break;
default:
break;
提前致谢!
【问题讨论】:
你能帮我解决类似的问题吗?参考***.com/questions/7581435/… 【参考方案1】:解决了这个问题。我使用了似乎与 setFullscreen 不兼容的 MPMovieControlStyleFullscreen。使用 MPMovieControlStyleEmbedded 它可以正常工作...奇怪(错误?)。
【讨论】:
以上是关于MPMoviePlayerController:无法从全屏切换到嵌入式的主要内容,如果未能解决你的问题,请参考以下文章
MPMoviePlayerController 不播放 .wmv
如何显示 MPMoviePlayerController 控件?
MPMoviePlayerController 隐藏 AirPlay 按钮
MPMoviePlayerController 上的专辑封面