new Twilio.Video.LocalVideoTrack(mediaStreamTrack, options)
Construct a LocalVideoTrack from MediaStreamTrack.
Parameters:
| Name | Type | Description |
|---|---|---|
mediaStreamTrack |
MediaStreamTrack | The underlying MediaStreamTrack |
options |
LocalTrackOptions | LocalTrack options |
Extends
Members
-
stop
-
See LocalTrack#stop.
- Overrides:
Methods
-
attach()
-
Attach the Track to a newly created HTMLMediaElement.
The HTMLMediaElement's
srcObjectwill be set to a new MediaStream containing the Track's MediaStreamTrack.- Inherited From:
- Overrides:
Returns:
Either an HTMLAudioElement or HTMLVideoElement, depending on the Track's kind
- Type
- HTMLMediaElement
Example
var Video = require('twilio-video'); Video.createLocalVideoTrack().then(function(track) { var videoElement = track.attach(); document.getElementById('my-container').appendChild(videoElement); }); -
detach()
-
Detach a Track from all previously attached HTMLMediaElements.
- Inherited From:
- Overrides:
Returns:
The detachedHTMLMediaElements
- Type
- Array.<HTMLMediaElement>
Example
var detachedElements = track.detach(); detachedElements.forEach(function(el) { el.remove(); }); -
disable()
-
Disable the LocalVideoTrack. This is effectively "pause".
- Overrides:
Fires:
Returns:
- Type
- this
-
enable( [enabled])
-
Enable or disable the LocalVideoTrack. This is effectively "unpause" or "pause".
Parameters:
Name Type Argument Description enabledboolean <optional>
Specify false to pause the LocalVideoTrack
- Overrides:
Fires:
Returns:
- Type
- this
-
enable()
-
Enable the LocalVideoTrack. This is effectively "unpause".
- Overrides:
Fires:
Returns:
- Type
- this
Type Definitions
-
Dimensions
-
A VideoTrack's width and height.
Type:
- object
- Inherited From:
Properties:
Name Type Argument Description widthnumber <nullable>
The VideoTrack's width or null if the VideoTrack has not yet started
heightnumber <nullable>
The VideoTrack's height or null if the VideoTrack has not yet started
Events
-
dimensionsChanged
-
The VideoTrack's dimensions changed.
Parameters:
Name Type Description trackVideoTrack The VideoTrack whose dimensions changed
- Inherited From:
-
disabled
-
The Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".
Parameters:
Name Type Description trackTrack The Track that was disabled
- Inherited From:
- Overrides:
-
enabled
-
The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".
Parameters:
Name Type Description trackTrack The Track that was enabled
- Inherited From:
- Overrides:
-
started
-
Parameters:
Name Type Description trackTrack The Track that started
- Inherited From:
- Overrides:
-
stopped
-
The LocalTrack was stopped, either because LocalTrack#stop was called or because the underlying MediaStreamTrack ended).
Parameters:
Name Type Description trackLocalTrack The LocalTrack that stopped
- Inherited From: