麦克风状态
我正在编写一个使用 MediaRecorder 来录制音频的应用程序。 (我使用Android 2.1)
- 在开始录音之前我想知道麦克风的状态(忙还是闲)?
- 如果麦克风繁忙,我可以获得独占访问权吗?
提前致谢!
I am writing an application that uses MediaRecorder for recording audio. ( I use Android 2.1 )
- Before start recording I want to know the microphone's state (is it busy or no)?
- If the microphone busy, can I get exclusive access to it?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回答1个问题:
读了很多文章后我意识到这是不可能的。
Answer to 1 question:
After reading many articles I realized that it was impossible.
这是一个老问题,但我展示了解决这个问题的方法。也许有人需要这种帮助。注意:这是一种肮脏的方式,但对我有用。
您可以尝试/捕获 MediaRecorderObject.start()。如果麦克风正忙,您将收到异常
It's an old question but I show the way I solve this problem. Maybe someone will need this help. Note: it's a dirty way but it worked for me.
You can try/catch MediaRecorderObject.start(). You will get an exception if the mic is busy