Currently, I am using Android MediaRecorder class to record video and writing it to a file.
recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
recorder.setOutputFile("/sdcard/recordtest.m4e"); But is there anyway I can write it to a socket?
It is probably better to read from the file in another thread and send that to a socket.
In response to your specific question: You can open a Socket, get a ParcelFileDescriptor and pass that into the MediaRecorder's setOutputFile method.
This page describes how, complete with pseudo code: http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system
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