Properties:
Name | Type | Description |
---|---|---|
attachments |
Map.<HTMLElement, Map.<Track, HTMLElement>> | A Map from <div> elements to a Map from Tracks to their attached HTMLElements (managed by Media#attach and Media#detach) |
audioTracks |
Map.<Track.ID, AudioTrack> | The AudioTracks on this Media object |
isMuted |
boolean | True if every AudioTrack on this Media object is disabled |
isPaused |
boolean | True if every VideoTrack on this Media object is disabled |
mediaStreams |
Set.<MediaStream> | The MediaStreams associated with the Tracks on this Media object |
tracks |
Map.<Track.ID, Track> | The AudioTracks and VideoTracks on this Media object |
videoTracks |
Map.<Track.ID, VideoTrack> | The VideoTracks on this Media object |
Fires:
Methods
-
attach(el)
-
Attach the Media to an existing HTMLElement.
Parameters:
Name Type Description el
HTMLElement The HTMLElement to attach to
Returns:
- Type
- HTMLElement
Example
var remoteMediaEl = document.getElementById('remote-media'); media.attach(remoteMediaEl);
-
attach(selector)
-
Attach the Media to an HTMLElement selected by
document.querySelector
.Parameters:
Name Type Description selector
string A query selector for the HTMLElement to attach to
Returns:
- Type
- HTMLElement
Example
var remoteMediaEl = media.attach('div#remote-media');
-
attach()
-
Attach the Media to a newly created <div> element.
Returns:
- Type
- HTMLElement
Example
var remoteMediaEl = media.attach(); document.getElementById('div#remote-media-container').appendChild(remoteMediaEl);
-
detach(el)
-
Detach the Media from a previously attached HTMLElement.
Parameters:
Name Type Description el
HTMLElement The HTMLElement to detach from
Returns:
- Type
- HTMLElement
Example
var remoteMediaEl = document.getElementById('remote-media'); media.detach(remoteMediaEl);
-
detach(selector)
-
Detach the Media from a previously attached HTMLElement selected by
document.querySelector
.Parameters:
Name Type Description selector
string A query selector for the HTMLElement to detach from
Returns:
- Type
- HTMLElement
Example
var detachedMediaEl = media.detach('div#remote-media');
-
detach()
-
Detach the Media from any and all previously attached HTMLElements.
Returns:
- Type
- Array.<HTMLElement>
Example
var detachedMediaEls = media.detach();
Events
-
trackAdded
-
Parameters:
Name Type Description track
Track The Track that was added
-
trackDimensionsChanged
-
The dimensions of a VideoTrack on this Media object changed.
Parameters:
Name Type Description track
VideoTrack The VideoTrack whose dimensions changed
-
trackDisabled
-
Parameters:
Name Type Description track
Track The Track that was disabled
-
trackEnabled
-
Parameters:
Name Type Description track
Track The Track that was enabled
-
trackRemoved
-
Parameters:
Name Type Description track
Track The Track that was removed
-
trackStarted
-
Parameters:
Name Type Description track
Track The Track that was started