How to record video on Android into Stream

android, media, mediarecorder, stream

Solution

Using Android-specific LocalServerSocket seems to be the only possible way to get video data as stream. In brief, you have to:

- create LocalServerSocket instance

- set it as output file to MediaRecorder instance using file descriptor (mediaRecorder.setOutputFile(FileDescriptor fd);)

- accept connection

- read bytes from it (as from InputStream) in separate thread in loop

Another ideas?

Problem

Android MediaRecorder allows to save video to file (file or socket): ``` setOutputFile(FileDescriptor fd); setOutputFile(String path) ``` How to save videodata to OutputStream? It will be used for streaming video recording.

Original source

Related problems