Fix Jitsi co-website reloading

This commit is contained in:
Alexis Faizeau 2022-02-10 15:37:04 +01:00
parent 7b6a3949bc
commit 666b6df588
2 changed files with 6 additions and 6 deletions

View File

@ -2156,9 +2156,9 @@ ${escapedMessage}
); );
const jitsiUrl = allProps.get(GameMapProperties.JITSI_URL) as string | undefined; const jitsiUrl = allProps.get(GameMapProperties.JITSI_URL) as string | undefined;
coWebsite.setJitsiLoadPromise( coWebsite.setJitsiLoadPromise(() => {
jitsiFactory.start(roomName, this.playerName, jwt, jitsiConfig, jitsiInterfaceConfig, jitsiUrl) return jitsiFactory.start(roomName, this.playerName, jwt, jitsiConfig, jitsiInterfaceConfig, jitsiUrl);
); });
coWebsiteManager.loadCoWebsite(coWebsite).catch((err) => { coWebsiteManager.loadCoWebsite(coWebsite).catch((err) => {
console.error(err); console.error(err);

View File

@ -5,7 +5,7 @@ import { jitsiFactory } from "../JitsiFactory";
import { SimpleCoWebsite } from "./SimpleCoWebsite"; import { SimpleCoWebsite } from "./SimpleCoWebsite";
export class JitsiCoWebsite extends SimpleCoWebsite { export class JitsiCoWebsite extends SimpleCoWebsite {
private jitsiLoadPromise?: CancelablePromise<HTMLIFrameElement>; private jitsiLoadPromise?: () => CancelablePromise<HTMLIFrameElement>;
constructor(url: URL, allowApi?: boolean, allowPolicy?: string, widthPercent?: number, closable?: boolean) { constructor(url: URL, allowApi?: boolean, allowPolicy?: string, widthPercent?: number, closable?: boolean) {
const coWebsite = coWebsiteManager.searchJitsi(); const coWebsite = coWebsiteManager.searchJitsi();
@ -17,7 +17,7 @@ export class JitsiCoWebsite extends SimpleCoWebsite {
super(url, allowApi, allowPolicy, widthPercent, closable); super(url, allowApi, allowPolicy, widthPercent, closable);
} }
setJitsiLoadPromise(promise: CancelablePromise<HTMLIFrameElement>): void { setJitsiLoadPromise(promise: () => CancelablePromise<HTMLIFrameElement>): void {
this.jitsiLoadPromise = promise; this.jitsiLoadPromise = promise;
} }
@ -32,7 +32,7 @@ export class JitsiCoWebsite extends SimpleCoWebsite {
return reject("Undefined Jitsi start callback"); return reject("Undefined Jitsi start callback");
} }
const jitsiLoading = this.jitsiLoadPromise const jitsiLoading = this.jitsiLoadPromise()
.then((iframe) => { .then((iframe) => {
this.iframe = iframe; this.iframe = iframe;
this.iframe.classList.add("pixel"); this.iframe.classList.add("pixel");