localTrackUpdated
Emitted when an existing local track is replaced with a new track
This event is emitted when an existing local track is replaced with a new track. This can occur when:
shareCustomVideoTrack()is called while already sharing videochooseAudioInputDevice()is called to switch audio input devices during an active meetingchooseVideoInputDevice()is called to switch video input devices during an active meetingstartVideo()is called while screen sharing (replaces screen with camera)startScreenShare()is called while sharing video (replaces camera with screen)
JavaScript
meeting.on("localTrackUpdated", function(localTrackItem) {
});
Properties
localTrackItem is an object that contains the following properties
| Property | Description | Type |
|---|---|---|
| type | type can be audio or video | string |
| streamId | unique streamId associated with the stream | string |
| track | MediaStreamTrack to add to a video tag you would need to convert it into a MediaStream object | object |
Example
JavaScript
meeting.on("localTrackUpdated", function(localTrackItem) {
if (localTrackItem.type === "video") {
// Update the video element with the new track
var track = localTrackItem.track;
var mediaStream = new MediaStream([track]);
document.getElementById("localvideo").srcObject = mediaStream;
}
});