Real-time video communication via WEBRTC (II.)

Source: Internet
Author: User

Real-time video communication via WebRTC (I.)

Real-time video communication via WEBRTC (II.)

Real-time video communication via WEBRTC (iii)

In the previous article, we explained WebRTC 's overview, history, security, and developer tools. The next step is to explain the process of building WebRTC through the WebRTC three API, which will be explained in this article MediaStream.

MediaStream (alias Getusermedia)

The MediaStream API represents the synchronization of media data streams. For example, the video stream from the camera is synchronized and tracked.

The simplest way to understand MediaStream is to look at its practical application:

    1. In Chrome or opera, open the demo Simpl.info/gum.

    2. Open the command line.

    3. View the global range of data rheology.

Each mediastream has an input that can be interpreted as a navigator generated by MediaStream. Getusermedia () can transmit video elements or rtcpeerconnection.

The Getusermedia () method has three parameters:

    • A Constraint object

    • A successful callback, if successful, will return a MediaStream

    • A failed callback that will return an Error object if it fails.

Each mediastream has a label, like ' Xk7eulhsuhkbnjlwkw4yygnjj8onsgwhbvlq ', Getaudiotradks () and Getaudiotracks () Method will return an array of Mediastreamtracks objects.

For Simpl.info/gum This example, Stream.getaudiotracks () returns an empty array (because there is no audio), assuming that a camera connection has been successful, getvideotracks () Returns an array of Mediastreamtrack objects that represent the data streams obtained from the camera. Each mediastreamtrack has a type (' video ' or ' audio '), and a label (for one or more channels), in this case, only video track, but it's easy to imagine where you can use this example, For example, a chat application front camera, rear camera, a screen sharing software and so on.

In Chrome or opera, the Url.createobjecturl () method converts MediaStream into a Blob url,blob URL that can be viewed as the src of a video element. (In Firefox and Opera, the src of the video can be set by the data stream itself).

Getusermedia can also be used as an input node for the Network audio API:

。。。。。

Source: Real-time video communication via WEBRTC (II.)

Real-time video communication via WEBRTC (ii)

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.