Jitsi config properties

This commit is contained in:
Mickael Chimansky 2021-02-09 14:17:48 +01:00
parent adb535d1b6
commit 9c4d0aa32f
2 changed files with 44 additions and 7 deletions

View File

@ -669,11 +669,17 @@ export class GameScene extends ResizableScene implements CenterListener {
this.connection.emitQueryJitsiJwtMessage(this.instance.replace('/', '-') + "-" + newValue, adminTag);
} else {
const jitsiConfig = allProps.get("jitsiConfig") as string|undefined;
jitsiFactory.setJitsiConfig(jitsiConfig || undefined);
const jitsiInterfaceConfig = allProps.get("jitsiInterfaceConfig") as string|undefined;
jitsiFactory.setJitsiInterfaceConfig(jitsiInterfaceConfig || undefined);
this.startJitsi(newValue as string);
}
layoutManager.removeActionButton('jitsiRoom', this.userInputManager);
}
const jitsiTriggerValue = allProps.get(TRIGGER_JITSI_PROPERTIES);
if(jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
layoutManager.addActionButton('jitsiRoom', 'Click on SPACE to enter in jitsi meet room', () => {

View File

@ -3,6 +3,12 @@ import {mediaManager} from "./MediaManager";
import {coWebsiteManager} from "./CoWebsiteManager";
declare const window:any; // eslint-disable-line @typescript-eslint/no-explicit-any
const config = {
startWithAudioMuted: !mediaManager.constraintsMedia.audio,
startWithVideoMuted: mediaManager.constraintsMedia.video === false,
prejoinPageEnabled: false
}
const interfaceConfig = {
SHOW_CHROME_EXTENSION_BANNER: false,
MOBILE_APP_PROMO: false,
@ -26,6 +32,8 @@ const interfaceConfig = {
};
class JitsiFactory {
public jitsiConfig: object = config;
public jitsiInterfaceConfig: object = interfaceConfig;
private jitsiApi: any; // eslint-disable-line @typescript-eslint/no-explicit-any
private audioCallback = this.onAudioChange.bind(this);
private videoCallback = this.onVideoChange.bind(this);
@ -39,12 +47,8 @@ class JitsiFactory {
width: "100%",
height: "100%",
parentNode: cowebsiteDiv,
configOverwrite: {
startWithAudioMuted: !mediaManager.constraintsMedia.audio,
startWithVideoMuted: mediaManager.constraintsMedia.video === false,
prejoinPageEnabled: false
},
interfaceConfigOverwrite: interfaceConfig,
configOverwrite: this.jitsiConfig,
interfaceConfigOverwrite: this.jitsiInterfaceConfig
};
if (!options.jwt) {
delete options.jwt;
@ -88,6 +92,33 @@ class JitsiFactory {
}
}
public setJitsiConfig(jitsiConfig: string|undefined): void {
if(jitsiConfig) {
try {
const parsedConfig = JSON.parse(jitsiConfig);
this.jitsiConfig = {...config, ...parsedConfig};
} catch (e) {
console.warn('jitsiConfig', e);
this.jitsiConfig = config;
}
} else {
this.jitsiConfig = config;
}
}
public setJitsiInterfaceConfig(jitsiInterfaceConfig: string|undefined): void {
if(jitsiInterfaceConfig) {
try {
const parsedInterfaceConfig = JSON.parse(jitsiInterfaceConfig);
this.jitsiInterfaceConfig = {...interfaceConfig, ...parsedInterfaceConfig};
} catch (e) {
console.warn('jitsiInterfaceConfig', e);
this.jitsiInterfaceConfig = interfaceConfig;
}
} else {
this.jitsiInterfaceConfig = interfaceConfig;
}
}
}
export const jitsiFactory = new JitsiFactory();