在我的 ViewController 中,我放置MPMoviePlayerController
播放视频。它工作正常。它也可以在全屏模式下播放。现在,我需要在横向右侧和横向左侧播放这部电影。我如何实现这一目标?而且,重要的一点是我的应用只支持纵向模式。我只想在两个方向上显示这个电影播放器。我怎么做?任何想法都值得!
这是我的代码 -
-(void)playMovie
{
NSString *movieURL = ___;
NSURL *url = [NSURL URLWithString:movieURL];
player = [[MPMoviePlayerController alloc]initWithContentURL:url];
self._moviePlayer = player;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:_moviePlayer];
_moviePlayer.controlStyle = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
_moviePlayer.view.frame = CGRectMake(10, shortDesc.frame.origin.y+shortDesc.frame.size.height+10, 280,150);
[_moviePlayer play];
}
- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
player = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];
if ([player respondsToSelector:@selector(setFullscreen:animated:)]) {
}
}