使用语音输入功能时录制音频
我正在开发一个 Android 4.0 (minSDKVersion=14
) 应用程序,我想在其中录制使用语音输入功能(通过软键盘上的小麦克风图标)时说出的音频。
通过 MediaRecorder
进行录制的组件不是这里的问题。我正在寻找的是一种利用语音输入功能的方法,就像用户按下麦克风按钮时调用的监听器一样。
我尝试了不同的方法,例如子类化 EditView
并实现 onKeyPreIme()
方法来捕获麦克风按钮事件或使用 RecognitionListener
接口。但对于一个简单的需求来说,这实在是太粗糙了。我想保留默认的语音输入功能,并在识别开始(和结束)时收到通知。有什么想法吗?
I am developing an Android 4.0 (minSDKVersion=14
) app where I want to record the audio that is spoken while using the Voice Typing feature (via the little microphone icon on the softkeyboard).
The recording component via MediaRecorder
is not the issue here. What I am searching is a way to tap into the Voice Typing function, like a Listener that is called when the user presses the microphone button.
I tried different things like subclassing EditView
and implementing the onKeyPreIme()
method for capturing the microphone button event or working with the RecognitionListener
interface. But that is all too much cruft around a simple need. I want to keep the default Voice Typing functionality and just be notified when the recognition starts (and ends). Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论