views:

170

answers:

1

I find MPMoviePlayerController.h,there is

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;

but when i did

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

it prints out 5 or sometimes 3,how did it happen?As i know the loadstate has value of 0,1,2,4 refer to developer documentation. Thank you!

+2  A: 

The playState is a bitmask. Any number of bits can be set, such as

MPMovieLoadStatePlaythroughOK | MPMovieLoadStatePlayable

Check for states like this:

MPMovieLoadState state = [playerController loadState];
if( state & MPMovieLoadStatePlaythroughOK ) {
        NSLog(@"State is Playthrough OK");
} 
flitzwald
that‘s right~thank you
ben
Cirrostratus