Adding Jitsi meet support

This commit is contained in:
David Négrier 2020-08-31 12:18:00 +02:00
parent a128ff117b
commit 0a8ba37049
9 changed files with 89 additions and 8 deletions

View file

@ -9,7 +9,7 @@ import {
PositionInterface
} from "../../Connection";
import {CurrentGamerInterface, hasMovedEventName, Player} from "../Player/Player";
import {DEBUG_MODE, POSITION_DELAY, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
import {DEBUG_MODE, JITSI_URL, POSITION_DELAY, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
import {ITiledMap, ITiledMapLayer, ITiledMapLayerProperty, ITiledTileSet} from "../Map/ITiledMap";
import {PLAYER_RESOURCES, PlayerResourceDescriptionInterface} from "../Entity/Character";
import {AddPlayerInterface} from "./AddPlayerInterface";
@ -423,6 +423,32 @@ export class GameScene extends Phaser.Scene implements CenterListener {
CoWebsiteManager.loadCoWebsite(newValue as string);
}
});
let jitsiApi: any;
this.gameMap.onPropertyChange('jitsiRoom', (newValue, oldValue) => {
if (newValue === undefined) {
jitsiApi?.dispose();
CoWebsiteManager.closeCoWebsite();
} else {
CoWebsiteManager.insertCoWebsite((cowebsiteDiv => {
const domain = JITSI_URL;
const options = {
roomName: this.instance + "-" + newValue,
width: "100%",
height: "100%",
parentNode: cowebsiteDiv,
configOverwrite: {
prejoinPageEnabled: false
},
interfaceConfigOverwrite: {
SHOW_CHROME_EXTENSION_BANNER: false,
MOBILE_APP_PROMO: false
}
};
jitsiApi = new (window as any).JitsiMeetExternalAPI(domain, options);
jitsiApi.executeCommand('displayName', gameManager.getPlayerName());
}))
}
});
}
private switchLayoutMode(): void {