gpt4 book ai didi

ios6 moviePlayer 第一帧在创建时未出现

转载 作者:行者123 更新时间:2023-12-02 20:39:57 26 4
gpt4 key购买 nike

我的开放类 Controller 中有一些方法可以实例化 moviePlayer,它设置为“autoPlay = NO”;

我已将 movieplayer.view 添加为 Controller View 的 subview ,对其进行配置并在顶部创建一个全屏按钮以启动视频。从iOS4.3开始,这一直工作得很好。该按钮是透明的,并且显示视频的第一帧(这是自定义汽车自动启动按钮的图片)。

从 iOS6 开始,我只能看到黑屏。单击图像按钮确实会按预期启动视频;调用[moviePlayer播放]

有什么变化是我没有考虑到的吗?我已经提供了我认为必要的两段代码。

#define INTRO_MOVIE @"Intro.mov"
-(void)viewDidLoad
{
if(SHOULD_PLAY_INTRO_VIDEO)//Debug switch to ignore the intro video
{
// Prepare the movie and player
[self configureIntroMoviePlayer];
[self.view addSubview:moviePlayer.view];
[self.view bringSubviewToFront:moviePlayer.view];

// Add and Show the Start Button to start the App
[self configureStartButton];
[self.view addSubview:startButton];
}
}

-(void)configureIntroMoviePlayer
{
LOGINFO
// Prepare the Intro Video
NSString *pathToIntroVideo = [ mainFilePath_ stringByAppendingPathComponent: INTRO_MOVIE];
NSURL *URLToIntroVideo = [NSURL fileURLWithPath:pathToIntroVideo];

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:URLToIntroVideo];
[moviePlayer setShouldAutoplay:NO];
moviePlayer.view.frame = CGRectMake(0, -20, 1024, 768);
[moviePlayer setControlStyle:MPMovieControlStyleNone];

//fixing video brightness Difference with iPad2
if(isIpad2)
{
moviePlayer.backgroundView.backgroundColor = [UIColor blackColor];
moviePlayer.view.alpha = .99;
}

// Create the sKip button for cancelling the Intro Video
skipIntro = [UIButton buttonWithType:UIButtonTypeCustom];
[skipIntro showsTouchWhenHighlighted];
skipIntro.frame = CGRectMake(900, 20, 111, 57);
[skipIntro addTarget:self action:@selector(skipIntroWasPressed) forControlEvents:UIControlEventTouchUpInside];

}

最佳答案

我不确定为什么我因缺乏研究或清晰度而对该问题获得 -1 评级?也许我不知道这个论坛的正确用法。我道歉。

我确实发现添加 [moviePlayerprepareToPlay] 解决了问题。就像我说的,奇怪的是第一帧总是在 iOS 6 之前出现。

关于ios6 moviePlayer 第一帧在创建时未出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13017597/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com