如何知道MediaRecorder是否处于运行状态?
我编写了一个代码来使用 MediaRecorder 录制通话对话的音频。
我如何知道 MediaRecorder 是否处于运行状态,以停止录制。 就像
boolean running;
MediaRecorder mr;
//what should i assign to running?
if(running){
mr.stop()
}
上面的代码只是一个例子..如果您不明白我的问题,请告诉我..我会用实际代码清楚地解释..
我想知道的是“MediaRecorder处于哪种状态?” ->录音/发布/准备/初始/等等..
I wrote a code to record audio of call conversation using MediaRecorder.
how can i know whether a MediaRecorder is in running state or not, to stop the recording.
like
boolean running;
MediaRecorder mr;
//what should i assign to running?
if(running){
mr.stop()
}
Above code is just an example.. If you do not understand my question, please tell me.. i will explain clearly with actual code..
What all i want to know is "In which state the MediaRecorder is?" -> recording/released/prepared/initial/etc..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您无法直接获取状态,请参阅 http:// code.google.com/p/android/issues/detail?id=800
当媒体播放器达到某个状态时,您需要在侦听器中手动设置一个变量,以便记住当前状态。
还有这个讨论:
http://www.mail-archive.com/[电子邮件受保护]/msg35320.html
You cannot get the state directly, see the open enhancement request at http://code.google.com/p/android/issues/detail?id=800
You need to set a variable manually in the listeners when the mediaplayer reaches a certain state in order to remember the current state.
Also this this discussion:
http://www.mail-archive.com/[email protected]/msg35320.html
参考:
https://developer.mozilla.org/en-US/文档/Web/API/MediaRecorder/状态
Reference:
https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/state