Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to create your own mediaStreamTrack using say, JSON objects?

Tags:

webrtc

The mediaStream interface on webRTC allows multiple MediaStreamTracks and these don't necessary need to be audio and/or video streams from your camera/microphone.

How can I create a MediaStreamTrack using lets say JSON objects?

like image 940
cggaurav Avatar asked Feb 13 '13 22:02

cggaurav


People also ask

What is MediaStreamTrack?

The MediaStreamTrack interface represents a single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well.

What is insertable streams?

In WebRTC, "insertable streams" refers to the ability to manipulate raw audio or video content and introduce new components to streams. Some use cases for insertable streams include: "Funny hats" or other video conferencing gadgets.

What is a media stream in JS?

The MediaStream interface represents a stream of media content. A stream consists of several tracks, such as video or audio tracks. Each track is specified as an instance of MediaStreamTrack . You can obtain a MediaStream object either by using the constructor or by calling functions such as MediaDevices.

What is media stream?

Streaming media is video or audio content sent in compressed form over the internet and played immediately over a user's device, rather than being saved to the device hard drive or solid-state drive.


2 Answers

The RTCDataChannel is exactly what you need. See: https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel

From the page above: "The RTCDataChannel interface represents a network channel which can be used for bidirectional peer-to-peer transfers of arbitrary data."

like image 66
GabeyBaby Avatar answered Sep 22 '22 14:09

GabeyBaby


In one of the recent meetings the subject was on the table, and it may be possible in the future. This can be used to allow the application to use more than one device of the same type.

We will be able to create the object of the streams tracks, but the Media Stream is always provided by the browser. Either it is a local Media Stream and you get it from the getUserMedia() method, or it's a remote Media Stream and you receive it from the peer connection.

The MediaStreamTrack is an object created by the browser API and the media in it (local or remote) is always provided by the browser, using microphones/cameras or media from the PeerConnection.

like image 28
nakib Avatar answered Sep 20 '22 14:09

nakib