Divided into two pieces:
1. Get video stream of webcam collection
2. Send to server side
protected Mediarecorder Mmediarecorder; Private Localserversocket mLss = null; Private Localsocket mreceiver, msender = null; MLss = new Localserversocket ("Myvideostream"); Mreceiver = new Localsocket (); Connect the MLSS, i.e. the receiving party initiates the connection 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. It is also possible to think that the video stream of the camera collection will continue //be sent to Mreceiver, and the video stream to Mserder input can be obtained through Mreceiver.getinputstream (). Msockethelper.setinputstream (Mreceiver.getinputstream ()); Msockethelper is your own encapsulation of sockets, depending on the encoding format of the Mmediarecorder. Implementation of different transmission mode Msockethelper.start ();
How the video data stream from the Android camera is sent to the target server in real time via socket