Skip to content

playStatus

isExist? edited this page Sep 22, 2016 · 2 revisions

播放状态

描述

说明播放器当前所处状态,如正在播放,暂停播放等

声明

typedef NS_ENUM(NSInteger, MPMoviePlaybackState) {
    MPMoviePlaybackStateStopped,
    MPMoviePlaybackStatePlaying,
    MPMoviePlaybackStatePaused,
    MPMoviePlaybackStateInterrupted,
    MPMoviePlaybackStateSeekingForward,
    MPMoviePlaybackStateSeekingBackward
};

变量

  • MPMoviePlaybackStateStopped - 播放停止
  • MPMoviePlaybackStatePlaying - 正在播放
  • MPMoviePlaybackStatePaused - 播放暂停
  • MPMoviePlaybackStateInterrupted - 播放被打断
  • MPMoviePlaybackStateSeekingForward - 向前seeking中
  • MPMoviePlaybackStateSeekingBackward - 向后seeking中

说明

  • 通过playbackState属性(只读)获取当前播放状态
  • 当接收到MPMoviePlayerPlaybackDidFinishNotification和MPMoviePlayerPlaybackStateDidChangeNotification通知时应调用playbackState获取一下当前播放器状态

示例代码

if (MPMoviePlayerPlaybackStateDidChangeNotification ==  notify.name) {
    NSLog(@"------------------------");
    NSLog(@"player playback state: %ld", (long)_player.playbackState);
    NSLog(@"------------------------");
}
Clone this wiki locally