Fixing a race condition in Jitsi

When setting the name, in rare cases, Jitsi was not initialized yet and setting the name would cause a JS error.
We are now waiting for Jitsi to be properly initialized before setting the name.
This commit is contained in:
David Négrier 2022-03-15 17:36:48 +01:00
parent b959ce7a6d
commit 79db6c8f3b

View File

@ -197,7 +197,10 @@ class JitsiFactory {
options.onload = () => doResolve(); //we want for the iframe to be loaded before triggering animations.
this.jitsiApi = new window.JitsiMeetExternalAPI(domain, options);
this.jitsiApi.executeCommand("displayName", playerName);
this.jitsiApi.addListener("videoConferenceJoined", () => {
this.jitsiApi?.executeCommand("displayName", playerName);
});
this.jitsiApi.addListener("audioMuteStatusChanged", this.audioCallback);
this.jitsiApi.addListener("videoMuteStatusChanged", this.videoCallback);