Update to restore previous config

This commit is contained in:
Gregoire Parant 2021-02-17 19:21:37 +01:00
parent e8b1b286a3
commit baae1e8125
2 changed files with 24 additions and 2 deletions

View File

@ -70,6 +70,7 @@ class JitsiFactory {
private jitsiApi: any; // eslint-disable-line @typescript-eslint/no-explicit-any
private audioCallback = this.onAudioChange.bind(this);
private videoCallback = this.onVideoChange.bind(this);
private previousConfigMeet? : jitsiConfigInterface;
/**
* Slugifies the room name and prepends the room name with the instance
@ -79,6 +80,9 @@ class JitsiFactory {
}
public start(roomName: string, playerName:string, jwt?: string, config?: object, interfaceConfig?: object): void {
//save previous config
this.previousConfigMeet = getDefaultConfig();
coWebsiteManager.insertCoWebsite((cowebsiteDiv => {
// Jitsi meet external API maintains some data in local storage
// which is sent via the appData URL parameter when joining a
@ -122,6 +126,19 @@ class JitsiFactory {
this.jitsiApi.removeListener('audioMuteStatusChanged', this.audioCallback);
this.jitsiApi.removeListener('videoMuteStatusChanged', this.videoCallback);
this.jitsiApi?.dispose();
//restore previous config
if(this.previousConfigMeet?.startWithAudioMuted){
mediaManager.disableMicrophone();
}else{
mediaManager.enableMicrophone();
}
if(this.previousConfigMeet?.startWithVideoMuted){
mediaManager.disableCamera();
}else{
mediaManager.enableCamera();
}
}
private onAudioChange({muted}: {muted: boolean}): void {

View File

@ -40,6 +40,11 @@
"name":"chillzone-2",
"opacity":1,
"properties":[
{
"name":"jitsiConfig",
"type":"string",
"value":"{ \"startWithAudioMuted\": true, \"startWithVideoMuted\": true } "
},
{
"name":"jitsiRoom",
"type":"string",
@ -433,7 +438,7 @@
"nextobjectid":2,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.3.3",
"tiledversion":"1.4.3",
"tileheight":32,
"tilesets":[
{
@ -2379,6 +2384,6 @@
}],
"tilewidth":32,
"type":"map",
"version":1.2,
"version":1.4,
"width":46
}