Use HTML element video.captureStream() as source for conference participant video

You can capture media stream with audio and video tracks. See:

Demo: https://webrtc.github.io/samples/src/content/capture/video-pc/
Source: https://github.com/webrtc/samples/tree/gh-pages/src/content/capture/video-pc
And in particular: js/main.js

Is it possible to use (or convert) this stream and tracks so, tad it is used as local Jitsi video stream and can be sent to server? I’m looking to create custom UI using lib-jitsi-meet

You can’t use directly tracks and add them to JitsiConference, as it expects object with additional methods and properties (JitsiLocalTrack), which is not exposed by lib-jitsi-meet.

var stream = $(`#videoId`)[0].captureStream();
var videoTracks = stream.getVideoTracks();
var audioTracks = stream.getAudioTracks();

if (videoTracks.length > 0) {
    var videoTrack = videoTracks[0];
    room.addTrack(videoTrack); // <- room is JitsiConference object and it expects JitsiLocalTrack
}
if (audioTracks.length > 0) {
    var audioTrack = audioTracks[0];
    room.addTrack(audioTrack); // <- room is JitsiConference object and it expects JitsiLocalTrack
}

Any suggestions how to achieve something similar with Jitsi? Screensharing is limited to 5 fps, I would expect better quality stream this way. And if you attach Jitsi remote track to video object, you could forward / retranslate remote video from one conference (room) to other conference (room). Or there is better way how to forward remote stream from one Jitsi conference to other conference?

1 Like

Hi there, I am also interested in this feature, it does not seem so possible right now, if you find something, please let me know.