Hi, I’m trying to build a page which activates a jitsi call (host). I want to launch screen share automatically. how can i achieve this
Welcome to the forum.
You can set the following property in your config.js to start a call with screensharing:
startScreenSharing: true,
Thanks Freddie.
But, its still not working.
this is my code:
<head>
<script src='https://meet.jit.si/external_api.js'></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://meet.jit.si/libs/lib-jitsi-meet.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.21/jquery.min.js"></script>
<script>
$(document).ready(function () {
const domain = 'meet.jit.si';
const options = {
roomName: 'testscreenShare',
width: 900,
height: 700,
parentNode: document.querySelector('#meet'),
configOverwrite: { prejoinPageEnabled: false },
interfaceConfigOverwrite: { TOOLBAR_BUTTONS: ['hangup', 'desktop', 'microphone', 'camera'] },
startScreenSharing: true,
};
const api = new JitsiMeetExternalAPI(domain, options);
//api.addEventListener('videoConferenceJoined', (response) => {
// //alert("Joined");
//});
function onBeforeUnload(e) {
e.preventDefault();
e.returnValue = '';
}
//api.on('videoConferenceLeft', (params) => { api.dispose(); window.close(); });
//window.addEventListener("beforeunload", this.onBeforeUnload);
});
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
function wait(ms) {
var start = new Date().getTime();
var end = start;
while (end < start + ms) {
end = new Date().getTime();
}
}
</script> </head>
<body>
<div id="meet" style="margin:0px auto; display:block;"></div>
</body>
Didn’t realize you’re trying to do this on meet.jit.si with iFrame. I don’t think the property is whitelisted - only whitelisted properties can be called in iFrame.
i figured it out, must mention “startScreenSharing: true” inside configOverwrite
2 Likes