有一个问题,MPMoviePlayerPlaybackDidFinishNotification
将 playbackState 作为 MPMoviePlaybackStatePaused
发送给我,这两种情况是我暂停还是 moviePlayer 自动完成播放。
MPMoviePlaybackStateStopped
只有在我手动停止时才会发生,即 [moviePlayer stop]
知道如何区分自动完成或暂停的场景。
提前致谢
最佳答案
来自文档
The following key may be found in the userInfo dictionary of a MPMoviePlayerPlaybackDidFinishNotification notification.
Swift
let MPMoviePlayerPlaybackDidFinishReasonUserInfoKey: String
OBJECTIVE-C
NSString *const MPMoviePlayerPlaybackDidFinishReasonUserInfoKey;
然后
The value of this key is an NSNumber containing an integer value that represents one of the “MPMovieFinishReason” constants.
MPMovieFinishReason 是枚举,您有 PlaybackEnded 和 UserExited
声明 快捷方式
enum MPMovieFinishReason : Int {
case PlaybackEnded
case PlaybackError
case UserExited
}
objective-C
enum {
MPMovieFinishReasonPlaybackEnded,
MPMovieFinishReasonPlaybackError,
MPMovieFinishReasonUserExited
};
typedef NSInteger MPMovieFinishReason;
这是 documentation .
关于iOS MPMoviePlayerController 无法判断是否暂停或自动完成播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33751023/