使用 MediaPlayer 作为源在 Android 上录制音频? [英] Record audio on Android with MediaPlayer as source?
问题描述
在 Android 上,您可以使用 MediaRecorder 类从麦克风录制音频:MediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
On Android, you can record audio from the microphone using the MediaRecorder class: MediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
我想录制由 MediaPlayer 实例(或其他一些音频播放设备)播放的音频的某些部分.那可能吗?我将如何设置自定义音频源?
I want to record some parts of audio being played by a MediaPlayer instance instead (or some other audio playback device). Is that possible? How would I set a custom audio source?
总结;如何将音频从任意音频源流式传输到 MediaRecorder?
推荐答案
我认为目前没有 API.尽管这是可能的,但您必须能够访问设备的缓冲区,直到内核/硬件级别.即使您找到了方法,我也不认为 Android 会允许您在应用程序级别执行此操作.
I don't think there is an API for that for now. Though it IS possible, you would have to have access to the device's buffer, down to the kernel/hardware level. Even if you find a way, I don't think Android would give you permission to do this on application level.
这篇关于使用 MediaPlayer 作为源在 Android 上录制音频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!