播放前将视频置于暂停状态
我正在使用 MVMoviePlayer 在应用程序中播放视频。现在,点击播放按钮后会出现黑屏,视频开始播放。但是,从用户端的角度来看,黑屏给用户带来了一些不适。所以,我想从暂停状态开始播放视频。 为了做到这一点,我想在播放之前将播放器置于暂停状态。
有没有办法做到这一点???
I am using MVMoviePlayer to play videos in the app. Right now, a black screen comes after taping the play button and the video starts playing. But, the black screen is casing some discofort from the user end point of view. So, i want to start the video from a paused state.
In order to do this, i thought of putting the player to paused state before playing it..
Is there a way to do this???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以隐藏您的
MPMoviePlayer
,直到恼人的黑色闪烁消失。为了确保黑色闪烁消失,您可以检查
MPMoviePlayer
的loadState
是否为 3(这意味着MPMovieLoadStatePlayable
|MPMovieLoadStatePlaythroughOK
)且playbackState
为 1(这意味着MPMoviePlaybackStatePlaying
)首先隐藏您的
MPMoviePlayer
:只需添加一个观察者,以便在 loadState 更改时收到通知:
并在收到通知且满足条件时使您的 MPMoviePlayer 再次可见:
You can hide your
MPMoviePlayer
until that annoying black flicker is gone.To ensure that the black flicker is gone, you can check if the
MPMoviePlayer
'sloadState
is 3 ( which meansMPMovieLoadStatePlayable
|MPMovieLoadStatePlaythroughOK
) andplaybackState
is 1 (which meansMPMoviePlaybackStatePlaying
)First hide your
MPMoviePlayer
:Just add an observer to be notified when loadState changes:
And make your MPMoviePlayer visible again when you are notified and conditions are met: