Hi,
I am trying to implement a screen share function with lib-jitsi-meet.js. I use the following logic to replace the current video track with the new screen track.
When the screen sharing participant creates a desktop track and replaces his own local video track in the conference, it takes around 30 seconds for the update to arrive in the other participants’ side. (Other participants to see the shared video. Until then they’ll have no content in the stream.) But the JitsiMeetJS.events.track.TRACK_VIDEOTYPE_CHANGED event fires immediately after the first participant starts the screen share.
IS THERE A P2P IMPACT?
I have tried with different number of participants, and this particular behaviour is observed only when the p2p mode is not there. (Tested with 2 or more participants and verified with chrome://webrtc-internals/)
When there are only two participants, the shared screen appear immediately on the other side.
Apparently, when the streams go through the servers, the replaceTrack function creates a huge delay in passing the new stream’s content.
Is this a known behaviour? (I tested the example application and it behaves in the same way.)
What can be done to make the application more responsive in this matter? (I suppose the asynchronous code represents exactly how the jitsi-meet handles the same behaviour with promises.)
Is there any server config that might affect this behaviour?
UPDATE
I an using room.replaceTrack(oldTrack, newTrack);
Switching to desktop track from camera track takes more time than switching to camera track from desktop track.
room.replaceTrack(cameraTrack, desktopTrack) → around 20, 30 seconds
room.replaceTrack(desktopTrack, cameraTrack) → within 5 seconds
I think jitsi-meet does not use remove track - add track it uses replace track, you can try debugging it and see what is the difference with your code.
This is my implementation. This is the same as in the jitsi-meet. (Apart from the fact that I use async/await style instead of promises.) I reproduced the issue with this code.
Is disposing the oldTrack required?
Can there be anything specific in jitsi about the desktop tracks? Because this is only reproducible with replaceTrack when the newTrack is a desktop track.
Hi @damencho
I managed to resolve this by adding the videoQuality configs. This is the added config change. Now lib-jitsi-meet manages to show the content to the other participants without any delay after replaceTrack is called.
Hi, I’m facing the same issue. But in my case, I’m using react-app. Whenever I replace the tracks it takes around 20-30secs before the remote user gets the stream. It’s the same even after I applied your fix.
Also, I cloned your angular app and ran it locally. it’s still the same. after clicking on stop share. the remote users cannot see the camera video immediately.