MPMoviePlayer标准接口播放/暂停状态反射问题 [英] MPMoviePlayer standard interface play/pause status reflection issue

查看:91
本文介绍了MPMoviePlayer标准接口播放/暂停状态反射问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个组件大量使用MPMoviePlayerController并且最近显示了一个奇怪的错误;当使用标准用户界面时(例如 MPMoviePlayerController.controlStyle = MPMovieControlStyleFullscreen; 玩家永远不会改变播放/暂停按钮的状态(那个东西)在我的截图中间。)

One of my components makes heavy use of MPMoviePlayerController and recently showed a weird bug; when using the standard user interface (e.g. MPMoviePlayerController.controlStyle = MPMovieControlStyleFullscreen;) the player never changes the state of the play/pause button (that thingy in the middle of my screenshot).

功能保持不变但玩家状态不会被UI反映出来。

The functionality stays intact but the player state is not reflected by the UI.

在播放电影时通过点击屏幕调出控件时,我会看到一个播放符号。我期待的是玩家目前正在玩的暂停符号。当点击播放符号时,播放器进入暂停模式。然而,符号不会改变。当再次点击该播放符号时,播放器继续播放,正如预期的那样。

When bringing up the controls by tapping on the screen while a movie is playing, I see a play-symbol. What I expect would be a pause-symbol as the player is currently playing. When tapping onto the play-symbol, the player goes into pause-mode. The symbol however does not change. When tapping again onto that play symbol, the player continues the playback, just as expected.

iOS5引入了这个问题,而以前的iOS版本没有这个问题。

The problem has been introduced with iOS5 and did not occur on previous iOS versions.

为了验证iOS5问题,我创建了一个不使用我自己的框架的简约播放器,确定问题没有发生,因此它必须是我的代码触发这个怪癖。不幸的是,我的代码非常大(大约3k行)所以我不能在这里发布。

For validating an iOS5 issues, I created a minimalistic player that is not using my own framework and sure enough the problem did not occur, hence it must be my code triggering this quirk. Unfortunately, my code is pretty damn large (about 3k lines) so I can not post it here.

我知道有人能够在没有源代码的情况下回答这个问题的机会很小,因为它似乎与我的代码直接相关。就像我现在一样绝望,我只是抓住了机会,希望有点奇怪,有人确实有这样的问题并知道如何触发/删除它。

I know chances of someone being able to answer this question without source code are pretty slim as it seems to be directly connected to my code. Being desperate as I am by now, I just took the chances and hope for a little wonder, somebody actually had such issue and knows how to trigger / remove it.

推荐答案

好吧,似乎我找到了答案(以及我称之为iOS5的错误)......

Well, it seems I found the answer (and what I would call an iOS5 bug)...

MPMoviePlayerController得到的原因激怒播放按钮的状态只是我初始化代码的顺序。

The reason for MPMoviePlayerController getting irritate on the status of the play button simply was the order of my initializing code.

要触发此问题,您只需运行此代码;

For triggering this issue, all you have to do is run this code;

moviePlayer = [[MPMoviePlayerController alloc] init];
moviePlayer.shouldAutoplay = YES;
moviePlayer.fullscreen = NO;
moviePlayer.view.frame = self.view.bounds;
moviePlayer.currentPlaybackTime = 0.0;
moviePlayer.initialPlaybackTime = 0.0;
[moviePlayer setContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]];
[self.view addSubview:moviePlayer.view];

您将看到一个播放器UI,它不会改变其付费/暂停状态。

You will see a player UI which does not change its Pay/Pause state.

为了让事情再次正常工作,您必须在设置播放时间之前移动setContentURL调用。

For getting things to work properly again, you have to move the setContentURL call before setting the playback-time.

moviePlayer = [[MPMoviePlayerController alloc] init];
moviePlayer.shouldAutoplay = YES;
moviePlayer.fullscreen = NO;
moviePlayer.view.frame = self.view.bounds;
[moviePlayer setContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]];
moviePlayer.currentPlaybackTime = 0.0;
moviePlayer.initialPlaybackTime = 0.0;
[self.view addSubview:moviePlayer.view];

我确实在Apple提交了一个错误(雷达错误ID#10484668) - 会让你发布他们的回答。

I did submit a bug at Apple (Radar Bug ID# 10484668) - will keep you posted on their answer.

OpenRadar Bug Report

这篇关于MPMoviePlayer标准接口播放/暂停状态反射问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆