LocalVideoTrack
Summary
LocalVideoTrack represents a video track that can be published to a Room.Remarks
It provides methods to attach and detach the track to and from HTMLVideoElements.Constructor
Construct a new video track from a MediaStreamTrack.
Signature
new LocalVideoTrack(mediaTrack: MediaStreamTrack, constraints?: MediaTrackConstraints, userProvidedTrack: boolean)
Name | Type | Description |
---|---|---|
mediaTrack | MediaStreamTrack | |
constraints optional | MediaTrackConstraints | MediaTrackConstraints that are being used when restarting or reacquiring tracks |
userProvidedTrack | boolean | Signals to the SDK whether or not the mediaTrack should be managed (i.e. released and reacquired) internally by the SDK |
Properties
sid
optional
Server assigned id.
Server assigned id.
Remarks
The value set after the track is published to the server, or if it's a remote track.Type
string
streamState
Indicates the current state of stream.
Remarks
It'll indicate paused
if the track has been paused by the congestion controller.Type
StreamState
Accessors
Methods
attach
Attaches the track to an HTML video element.
Signature
attach(element?: HTMLVideoElement)
Name | Type | Description |
---|---|---|
element optional | HTMLVideoElement | The video element to attach to (optional). |
Returns
HTMLVideoElement
The HTMLVideoElement the video track is attached to.Remarks
If no element is provided, a new video element will be created and returned.detach
Detaches the track from an HTML video element.
Signature
detach(element?: HTMLMediaElement)
Name | Type | Description |
---|---|---|
element optional | HTMLMediaElement | The video element to detach from (optional). |
Returns
HTMLMediaElement
| HTMLMediaElement[]
The detached video element(s).Remarks
If no element is provided, the track will be detached from all previously attached elements.getDeviceId
Signature
getDeviceId()
Returns
Promise
<undefined | string
> DeviceID of the device that is currently being used for this track