Divided into two pieces:
1. Get the video stream captured by the camera
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 can be thought that the video stream will continue //Send to Mreceiver, through Mreceiver.getinputstream () You can get the video stream Msockethelper.setinputstream (Mreceiver.getinputstream ()) to the Mserder input ; Msockethelper is your own package of sockets, according to mmediarecorder different encoding format, to achieve a different way of sending Msockethelper.start ();