# class MediaStream

#### package js.html

#### extends EventTarget

Available on HTML5

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`.

Documentation MediaStream by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

https://developer.mozilla.org/en-US/docs/Web/API/MediaStream

### Constructor

###

`new (tracks:Array<MediaStreamTrack>)`

`new ()`

`new (stream:MediaStream)`

Throws:

`null` | DOMError

### Variables

###

`read onlycurrentTime:Float`

###

`read onlyid:String`

A `DOMString` containing 36 characters denoting a universally unique identifier (UUID) for the object.

### Methods

###

`addTrack (track:MediaStreamTrack):Void`

Stores a copy of the `MediaStreamTrack` given as argument. If the track has already been added to the `MediaStream` object, nothing happens.

###

`getAudioTracks ():Array<AudioStreamTrack>`

###

`getTracks ():Array<MediaStreamTrack>`

Returns a list of all `MediaStreamTrack` objects stored in the `MediaStream` object, regardless of the value of the `kind` attribute. The order is not defined, and may not only vary from one browser to another, but also from one call to another.

###

`getVideoTracks ():Array<VideoStreamTrack>`

Returns a list of the `MediaStreamTrack` objects stored in the `MediaStream` object that have their `kind` attribute set to `"video"`. The order is not defined, and may not only vary from one browser to another, but also from one call to another.

###

`removeTrack (track:MediaStreamTrack):Void`

Removes the `MediaStreamTrack` given as argument. If the track is not part of the MediaStream` object, nothing happens.

### Inherited Variables

### Inherited Methods

#### Defined by EventTarget

###

`addEventListener (type:String, listener:Function, capture:Bool = false):Void`

`addEventListener (type:String, listener:EventListener, capture:Bool = false, ?wantsUntrusted:Bool):Void`

Throws:

`null` | DOMError

###

`dispatchEvent (event:Event):Bool`

Throws:

`null` | DOMError

###

`removeEventListener (type:String, listener:Function, capture:Bool = false):Void`

`removeEventListener (type:String, listener:EventListener, capture:Bool = false):Void`

Throws:

`null` | DOMError