new Twilio.Video.LocalVideoTrack(mediaStreamTrack [, options])
Construct a LocalVideoTrack from a MediaStreamTrack.
Parameters:
| Name | Type | Argument | Description | 
|---|---|---|---|
mediaStreamTrack | 
            
            MediaStreamTrack | The underlying MediaStreamTrack  | 
        |
options | 
            
            LocalTrackOptions | 
                
                    <optional> | 
            
            
            LocalTrack options  | 
        
Properties:
| Name | Type | Description | 
|---|---|---|
isStopped | 
            
            boolean | Whether or not the LocalVideoTrack is stopped  | 
        
Fires:
Extends
Members
Methods
- 
    
attach()
 - 
    
    
Create an HTMLVideoElement and attach the VideoTrack to it.
The HTMLVideoElement's
srcObjectwill be set to a new MediaStream containing the VideoTrack's MediaStreamTrack.- Inherited From:
 - Overrides:
 
Returns:
videoElement
- Type
 - HTMLVideoElement
 
Example
const Video = require('twilio-video'); Video.createLocalVideoTrack().then(function(videoTrack) { const videoElement = videoTrack.attach(); document.body.appendChild(videoElement); }); - 
    
detach()
 - 
    
    
Detach the VideoTrack from all previously attached HTMLMediaElements.
- Inherited From:
 - Overrides:
 
Returns:
mediaElements
- Type
 - Array.<HTMLMediaElement>
 
Example
const mediaElements = videoTrack.detach(); mediaElements.forEach(mediaElement => mediaElement.remove());
 - 
    
disable()
 - 
    
    
Disable the LocalVideoTrack. This is effectively "pause".
Fires:
Returns:
- Type
 - this
 
 - 
    
enable()
 - 
    
    
Enable the LocalVideoTrack. This is effectively "unpause".
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
Fires:
Returns:
- Type
 - this
 
 - 
    
stop()
 - 
    
    
Calls stop on the underlying MediaStreamTrack. If you choose to stop a LocalVideoTrack, you should unpublish it after stopping.
Fires:
Returns:
- Type
 - this
 
 
Events
- 
    
dimensionsChanged
 - 
    
    
The VideoTrack's dimensions changed.
Parameters:
Name Type Description trackVideoTrack The VideoTrack whose dimensions changed
- Inherited From:
 - Overrides:
 
 - 
    
disabled
 - 
    
    
The LocalVideoTrack was disabled, i.e. "muted".
Parameters:
Name Type Description trackLocalVideoTrack The LocalVideoTrack that was disabled
- Overrides:
 
 - 
    
enabled
 - 
    
    
The LocalVideoTrack was enabled, i.e. "unmuted".
Parameters:
Name Type Description trackLocalVideoTrack The LocalVideoTrack that was enabled
- Overrides:
 
 - 
    
started
 - 
    
    
The LocalVideoTrack started. This means there is enough video data to begin playback.
Parameters:
Name Type Description trackLocalVideoTrack The LocalVideoTrack that started
- Overrides:
 
 - 
    
stopped
 - 
    
    
The LocalVideoTrack stopped, either because LocalVideoTrack#stop was called or because the underlying MediaStreamTrack ended).
Parameters:
Name Type Description trackLocalVideoTrack The LocalVideoTrack that stopped