为什么MPMovieLoadState有州5?

时间:2010-06-29 07:24:45

标签: iphone iphone-sdk-3.0 mpmovieplayercontroller

我找到MPMoviePlayerController.h,有

enum {
    MPMovieLoadStateUnknown        = 0,
    MPMovieLoadStatePlayable       = 1 << 0,
    MPMovieLoadStatePlaythroughOK  = 1 << 1, // Playback will be automatically started in this state when shouldAutoplay is YES
    MPMovieLoadStateStalled        = 1 << 2, // Playback will be automatically paused in this state, if started
};
typedef NSInteger MPMovieLoadState;

但是当我做的时候

NSLog(@"%d",player.loadState)

它打印出5或有时3,它是如何发生的?我知道loadstate的值为0,1,2,4,请参阅开发人员文档。 谢谢!

1 个答案:

答案 0 :(得分:29)

playState是一个位掩码。可以设置任意数量的位,例如

MPMovieLoadStatePlaythroughOK | MPMovieLoadStatePlayable

检查这样的状态:

MPMovieLoadState state = [playerController loadState];
if( state & MPMovieLoadStatePlaythroughOK ) {
        NSLog(@"State is Playthrough OK");
}