使用语音输入功能时录制音频

发布于 2025-01-03 22:54:33 字数 387 浏览 4 评论 0原文

我正在开发一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文