Task: it is necessary to make the display of the camera in a webview. What came to mind: use MediaRecorder to record video in a socket. Raise the web server on the device (for example, use NanoHTTPD). On a web server, raise a page, with a js script for receiving data, converting and displaying data. Below is the code to write from MediaRecorder to the socket.

String hostname = "your.host.name"; int port = 1234; Socket socket = new Socket(InetAddress.getByName(hostname), port); ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(socket); MediaRecorder recorder = new MediaRecorder(); // Additional MediaRecorder setup (output format ... etc.) omitted recorder.setOutputFile(pfd.getFileDescriptor()); recorder.prepare(); recorder.start(); 

Original As I understand it, the code writes data in mp4 (depends on the settings of MediaRecorder) to the socket. The question arises: how to display all this on the js side? In theory, I have to bring this all to the trail. form 192.168.0.1:8088/ucking_hdmi.mp4. But how to achieve this?

    1 answer 1

    Here is a link to the same project on Github . There's kind of like html5 used. The implementation is the same as you intended

    • This is not a working project, there are not enough files. - Vadimcg