It can be divided into two parts:
1. Obtain the video stream collected by the camera
2. send to the server
Protected MediaRecorder mMediaRecorder; private LocalServerSocket mLss = null; private LocalSocket mReceiver, mSender = null; mLss = new LocalServerSocket ("myVideoStream"); mReceiver = new LocalSocket (); // connect to mLss, that is, the receiver actively initiates a connection to the mReceiver. connect (new LocalSocketAddress ("myVideoStream"); mReceiver. setReceiveBufferSize (100*1024); mSender = mLss. accept (); mSender. setSendBufferSize (100*1024); mMediaRecorder. start (); // mReceiver has established a connection with mSender, so you can think that the video streams collected by camera will continue // sent to mReceiver through mReceiver. getInputStream () can get the mSocketHelper Video Stream Input by mSerder. setInputStream (mReceiver. getInputStream (); // mSocketHelper is your own Socket encapsulation. Based on the different encoding formats of mMediaRecorder, mSocketHelper can be sent in different ways. start ();