mirror of
https://github.com/netzbegruenung/jitsi-meet-electron.git
synced 2024-05-11 13:06:06 +02:00
36 lines
1 KiB
JavaScript
36 lines
1 KiB
JavaScript
/* global process, JitsiMeetExternalAPI */
|
|
const {
|
|
RemoteControl,
|
|
setupScreenSharingForWindow
|
|
} = require("jitsi-meet-electron-utils");
|
|
const { jitsiMeetDomain } = require("../../config.js");
|
|
|
|
/**
|
|
* Loads a script from a specific source.
|
|
*
|
|
* @param src the source from the which the script is to be (down)loaded
|
|
* @param loadCallback on load callback function
|
|
* @param errorCallback callback to be called on error loading the script
|
|
*/
|
|
function loadScript(
|
|
src,
|
|
loadCallback = () => {},
|
|
errorCallback = console.error) {
|
|
const script = document.createElement('script');
|
|
|
|
script.async = true;
|
|
|
|
script.onload = loadCallback;
|
|
script.onerror = errorCallback;
|
|
script.src = src;
|
|
document.head.appendChild(script);
|
|
}
|
|
|
|
loadScript(`https://${jitsiMeetDomain}/external_api.js`, () => {
|
|
const api = new JitsiMeetExternalAPI(
|
|
process.env.JITSI_MEET_DOMAIN || jitsiMeetDomain);
|
|
const iframe = api.getIFrame();
|
|
setupScreenSharingForWindow(iframe);
|
|
new RemoteControl(iframe);
|
|
});
|