Android MediaRecoder writes it to the socket

I am currently using the Android MediaRecorder class to record video and write 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 can I write it to a socket anyway?

+3
source share
1 answer

It is probably best to read from a file in another stream and send it to the socket.

In response to your specific question: you can open Socket, get the ParcelFileDescriptor and pass it to the SetOutputFile MediaRecorder method.

This page describes how complete with the pseudo-code: http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system

+4

Source: https://habr.com/ru/post/1765961/


All Articles