Reputation: 185
I develop an Android app based on sound and video records. I would like to get a real-time playback of the mic audio in the headphones while previewing AND capturing the video and sound.
What i have now, working fine alone:
1) use Superpowered library to record audio and playing it back in real-time (during preview and record). Behind the scene, it does directly with C++ the work of AudioRecord by pushing the buffer to the output (headphones). The goal is to apply audio effects on the raw sound in real-time.
2) capture the video with mediaRecorder
When audio playback is running, I try to launch the video record, it crashes starting :
E/MediaRecorder: start failed: -2147483648
I imagine that i can't launch two recording process at the same time. I think using the AudioRecord or Superpowered lib is the good way to process the raw audio, but I can't figure out how to record video without conflicting with the current audio recording.
So is there a way to achieve my feature?
(minSdk 16)
Upvotes: 3
Views: 3650
Reputation: 3624
According bigflake
The MediaCodec class first became available in Android 4.1 (API 16). It was added to allow direct access to the media codecs on the device.
In Android 4.3 (API 18), MediaCodec was expanded to include a way to provide input through a Surface (via the createInputSurface method). This allows input to come from camera preview or OpenGL ES rendering.
So if it's possible please think about increasing MinSDK to 18 and use AudioVideoRecordingSample or HWEncoderExperiments as examples.
Upvotes: 2