You have to create separate offer for screen sharing like video conferencing inside handler onMessage
event.
janus.attach({
plugin: "janus.plugin.videoroom",
opaqueId: opaqueId,
success: function(pluginHandle) { ... },
error: function(error) { ... },
consentDialog: function(on) { ... },
mediaState: function(medium, on) { ... },
webrtcState: function(on) { ... },
onmessage: function(msg, jsep) {
...
//video conference
publishOwnfeed(true, false);
//Screen sharing
publishOwnfeed(false, true);
...
}
onlocalstream: function(stream) {
//This event will be called for two times
//one time with video stream
//second time with screen stream
},
onremotestream: function(stream) { ... },
oncleanup: function() { ... }
});
function publishOwnFeed(useAudio, isScreenSharing) {
...
sfutest.createOffer({
media: {
video: isScreenSharing ? "screen" : true // video constraint
audioRecv: false,
videoRecv: false,
audioSend: useAudio,
videoSend: true
},
simulcast: doSimulcast,
success: function(jsep) { ... },
error: function(error) { ... }
...
});
}
you can create separate hanldler with same plugin(plugin: "janus.plugin.videoroom") for screen sharing.If you want to handle(Ex. start,stop) separately
.