Android SDK Media Recorder.状态4 [英] Android SDK Media Recorder. State 4

查看:96
本文介绍了Android SDK Media Recorder.状态4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我才刚刚开发出快速的Android应用.

I'm just at the end of developing a quick Android App.

次要问题.什么是4状态?

Minor problem. What's state 4?

我正在使用MediaPlayer,每次运行该应用程序时,我都会收到一条错误消息,指出首先在状态0中调用媒体播放器"start()",然后在状态4中调用它.

I'm using MediaPlayer and every time I run the app I get an error stating that Media Player "start()" is first called in state 0, then state 4.

有人知道4状态是什么吗?

Does anyone know what state 4 is?

如果我知道状态1和2等状态,我就可以找出问题所在.

I can figure out the problem if I know the states such as state 1 and 2...

谢谢

推荐答案

这来自Android来源的MediaPlayer.h:

This is from MediaPlayer.h in the Android source:

enum media_player_states {
  MEDIA_PLAYER_STATE_ERROR        = 0,
  MEDIA_PLAYER_IDLE               = 1 << 0,
  MEDIA_PLAYER_INITIALIZED        = 1 << 1,
  MEDIA_PLAYER_PREPARING          = 1 << 2,
  MEDIA_PLAYER_PREPARED           = 1 << 3,
  MEDIA_PLAYER_DECODED            = 1 << 4,
  MEDIA_PLAYER_STARTED            = 1 << 5,
  MEDIA_PLAYER_PAUSED             = 1 << 6,
  MEDIA_PLAYER_STOPPED            = 1 << 7,
  MEDIA_PLAYER_PLAYBACK_COMPLETE  = 1 << 8
};

因此,0将为MEDIA_PLAYER_STATE_ERROR,而4将为MEDIA_PLAYER_PREPARING. 在调用start()之前调用过prepare()或prepareAsync()吗?

Therefore 0 would be MEDIA_PLAYER_STATE_ERROR and 4 would be MEDIA_PLAYER_PREPARING. Did you call prepare() or prepareAsync() before calling start()?

这些是MediaRecorder状态:

These are the MediaRecorder states:

enum media_recorder_states {
  MEDIA_RECORDER_ERROR                 =      0,
  MEDIA_RECORDER_IDLE                  = 1 << 0,
  MEDIA_RECORDER_INITIALIZED           = 1 << 1,
  MEDIA_RECORDER_DATASOURCE_CONFIGURED = 1 << 2,
  MEDIA_RECORDER_PREPARED              = 1 << 3,
  MEDIA_RECORDER_RECORDING             = 1 << 4,
};

因此,为了进行记录,状态4为MEDIA_RECORDER_DATASOURCE_CONFIGURED.

So for recording, state 4 is MEDIA_RECORDER_DATASOURCE_CONFIGURED.

这篇关于Android SDK Media Recorder.状态4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆