MPMovieController 全黑(虽然里面没有橄榄球 :D :D)
)
我的客户要求我将一段短视频作为启动画面来阅读(例如,这是专门为游戏而做的)。我用谷歌搜索了一下,我认为这些人使用 MPMoviePlayerController 并将 StyleControl 设置为 None (如果我错了,请纠正我......) 我尝试使用 iPhone 上的视频(通常格式正确,所以......),但仍然是黑屏。我的背景是红色的,我看到它出现在开头,然后它被我的视频隐藏,视频保持黑色并且永远不会开始。 然而,我设置了我的视频的框架(self.view 在当时被初始化),我添加了播放器来查看我的 self.view ...总之,我看不出有什么可能会乱七八糟。 这是代码(使用全屏控件尝试查看,但我也从未看到它们。 有什么想法吗? 谢谢大家;)
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
MPMoviePlayerController * mMoviePlayer;
// Do any additional setup after loading the view, typically from a nib.
NSURL* mMovieURL;
NSBundle *bundle = [NSBundle mainBundle];
if (bundle)
{
NSString *moviePath = [bundle pathForResource:@"movie" ofType:@"mov"];
if (moviePath)
{
mMovieURL = [NSURL fileURLWithPath:moviePath];
}
}
NSLog(@"%@", mMovieURL);
[[UIApplication sharedApplication] setStatusBarHidden:YES];
mMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:mMovieURL];
// mMoviePlayer.scalingMode = MPMovieScalingModeAspectFill;
mMoviePlayer.controlStyle = MPMovieControlStyleFullscreen;
[mMoviePlayer.view setFrame: self.view.bounds]; // player's frame must match parent's
[self.view addSubview: mMoviePlayer.view];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:mMoviePlayer];
[mMoviePlayer play];
}
)
My client asks me to read a short video as a splahscreen (as it is done especially for games for example). I googled for a bit and I think the guys use a MPMoviePlayerController with StyleControl to None (correct me if I'm wrong...)
I tried with a video from my iPhone (normally in the right format so ....), but remains black. My background is red, I see it appear at the beginning, then it is hidden by my video, which remains black and never starts.
However, I set out the frame of my video (self.view is initialized at the time), I add the player to view my self.view ... In short, I do not see what might messing around.
This is the code (with FullScreen controls to try to see, but I never see them either.
An idea by any chance?
Thx guys ;)
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
MPMoviePlayerController * mMoviePlayer;
// Do any additional setup after loading the view, typically from a nib.
NSURL* mMovieURL;
NSBundle *bundle = [NSBundle mainBundle];
if (bundle)
{
NSString *moviePath = [bundle pathForResource:@"movie" ofType:@"mov"];
if (moviePath)
{
mMovieURL = [NSURL fileURLWithPath:moviePath];
}
}
NSLog(@"%@", mMovieURL);
[[UIApplication sharedApplication] setStatusBarHidden:YES];
mMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:mMovieURL];
// mMoviePlayer.scalingMode = MPMovieScalingModeAspectFill;
mMoviePlayer.controlStyle = MPMovieControlStyleFullscreen;
[mMoviePlayer.view setFrame: self.view.bounds]; // player's frame must match parent's
[self.view addSubview: mMoviePlayer.view];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:mMoviePlayer];
[mMoviePlayer play];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试:
you may try: