使用MPMoviePlayerViewController以全屏模式播放视频时出现的问题

问题描述 投票:-2回答:2

我在使用MPMoviePlayerViewController以全屏模式播放视频时遇到问题(在正常模式下完美运行)。>>

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];
}

我在使用MPMoviePlayerViewController以全屏模式播放视频时遇到问题(在正常模式下完美运行)。代码:if(PlayV){self.previewView.hidden = NO;自我....

ios mpmovieplayer
2个回答
1
投票

我得到了解决方案。在playBtnAction方法中添加以下代码行:


0
投票
moviePlayer =  [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:imagepath]]; //moviePlayer declared in .h and set URL

moviePlayer.view.frame = CGRectMake(364, 89, 660, 668); //set custom frame
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view]; //add to view
[moviePlayer setFullscreen:NO animated:YES];
© www.soinside.com 2019 - 2024. All rights reserved.