I'm trying to
Any ideas how to achieve these ?
I tried to do use Android's MediaRecorder
(which records audio, encodes it and saves to File) and to use Android's HttpClient
with InputStreamEntity which allows uploading data from an input stream. I used "StreamingLoop" from https://github.com/Teaonly/android-eye/blob/master/src/teaonly/droideye/StreamingLoop.java to connect the output file descriptor to the inputStream so I could use the MediaRecorder's output for the HttpClient's input.
However this failed - When I stop the recording I get:
06-27 17:58:47.259: A/libc(6759): Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1), thread 6759
which crashes the application, and the file that arrives to the server is unplayable by VLC, so this is twice a failure.
Any ideas for a different method to do requirements 1..3 above or how to debug it?
use Audiorecord class and not mediaRecorder. API for the former gives you direct access to the buffer backing the microphone. You have control over a handler that writes from the buffer to a stream ( as in http chunked-encoding connection ). That will handle your streaming requirement.
Look at a git proj using audioRecord...
https://github.com/Audioboo/audioboo-android?source=c
see class=FLACRecorder.run() where it reads the AudioRecord buffer and writes it to the encoder(FLAC). If you want to stream the flac-encoded bytes, you can use this app , get the bytes downstream of the encoder and write that to the http connection like in this class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With