MediaPlayer服务几种常见状态
在开发音视频播放的时候,我们经常遇到多媒体服务调用状态不对而导致的异常,因为android 多媒体状态比较多,做具体的函数操作需要在特定的状态下调用。android的官网上也没给出详细的状态描述,从源码里摘抄多媒体服务状态的代表的意思,供大家参考。
enum media_player_states {
MEDIA_PLAYER_STATE_ERROR = 0,
MEDIA_PLAYER_IDLE = 1 << 0, // 1
MEDIA_PLAYER_INITIALIZED = 1 << 1, // 2
MEDIA_PLAYER_PREPARING = 1 << 2, // 4
MEDIA_PLAYER_PREPARED = 1 << 3, // 6
MEDIA_PLAYER_STARTED = 1 << 4, // 8
MEDIA_PLAYER_PAUSED = 1 << 5, // 16
MEDIA_PLAYER_STOPPED = 1 << 6, // 32
MEDIA_PLAYER_PLAYBACK_COMPLETE = 1 << 7 // 64
};