How the video data stream from the Android camera is sent to the target server in real time via socket

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.