From d36dcd276602b1ff2ad7177161d04f9b7c358c09 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 19 May 2022 04:24:39 -0400 Subject: [PATCH] Patch Jitsi logs into rageshakes (#22270) * Patch Jitsi logs into rageshakes * Remove unused import * Fix types --- src/vector/jitsi/index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 3852e0858c..d3eeb62d77 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -357,6 +357,8 @@ function joinConference(audioDevice?: string, videoDevice?: string) { startAudioOnly, startWithAudioMuted: audioDevice == null, startWithVideoMuted: videoDevice == null, + // Request all log levels for inclusion in rageshakes + apiLogLevels: ["warn", "log", "error", "info", "debug"], } as any, jwt: jwt, }; @@ -411,7 +413,7 @@ function joinConference(audioDevice?: string, videoDevice?: string) { meetApi.on("audioMuteStatusChanged", ({ muted }) => { const action = muted ? ElementWidgetActions.MuteAudio : ElementWidgetActions.UnmuteAudio; - widgetApi.transport.send(action, {}); + widgetApi?.transport.send(action, {}); }); meetApi.on("videoMuteStatusChanged", ({ muted }) => { @@ -421,10 +423,10 @@ function joinConference(audioDevice?: string, videoDevice?: string) { // otherwise the React SDK will mistakenly think the user turned off // their video by hand setTimeout(() => { - if (meetApi) widgetApi.transport.send(ElementWidgetActions.MuteVideo, {}); + if (meetApi) widgetApi?.transport.send(ElementWidgetActions.MuteVideo, {}); }, 200); } else { - widgetApi.transport.send(ElementWidgetActions.UnmuteVideo, {}); + widgetApi?.transport.send(ElementWidgetActions.UnmuteVideo, {}); } }); @@ -435,4 +437,9 @@ function joinConference(audioDevice?: string, videoDevice?: string) { }); }); }); + + // Patch logs into rageshakes + meetApi.on("log", ({ logLevel, args }) => + (parent as unknown as typeof global).mx_rage_logger?.log(logLevel, ...args), + ); }