Creating Screen Share and Video Stream together

I’m able to create Audio, Video and Screen Share at the time of initialization like this:

JitsiMeetJS.createLocalTracks({ devices: [ 'audio', 'video', 'desktop'] })

And I’m also able to add these tracks locally and remotely using addTrack() and it works perfectly fine with Audio, Video and Screen Share at the same time.

But problem is when I’m creating Audio and Video at the time of initialization and later I want to add a screen share then it is giving me following error while calling addTrack() to add desktop stream.

cannot add second video track to conference

Any idea if we can add screen share alongwith video track?

In multiple places in the system there are assumptions that a participant can have one audio and one video stream. So there is no such option.
You can try out on meet.jit.si - presenter mode. Start screen sharing and unmute your camera.

Thank you very much sir, I’m trying to develop our own GUI. But may I know why there is such limitation in the system? WebRTC does not impose any such restriction. Is it possible if we can modify the code and remove this restriction and re-compile lib-jitsi-meet?

You can remove the restriction, you need to handle the changes in lib-jitsi-meet, jicofo and jvb. It is how it was implemented while ago and this is the assumption today, everywhere.

Oh…definitely a big work. However thank you very much for the information. I really appreciate your time given to clarify it.

I’m sorry but would you suggest a hack like if I create two connections ( Room A for Video and Audio, Room B for Screen only). Do you think it will work or I will get stuck at some point?

What about presenter mode?

Sir I’m not sure if presentation mode implementation is available in lib-jitsi-meet?? If there is some API or documentation on how we can use it in our custom application?

No, it is not implemented there, it is in jitsi-meet which is using lib-jitsi-meet … but it is an option and you can look at the implementation in jitsi-meet.

Yes sir I have studied it, it’s super imposing presenter picture on the screen which serves the purpose but unfortunately it is not available in lib-jitsi-meet.

I am facing similar issue. Can you please tell how did you enable screen sharing on lib jitsi meet?