Merge pull request #1850 from thecodingmachine/stabilize-cowebsite

Fix Jitsi co-website reloading
This commit is contained in:
Alexis Faizeau 2022-02-10 15:50:59 +01:00 committed by GitHub
commit aa9b5e37c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -2157,9 +2157,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");