Skip to content

Commit

Permalink
Patch Jitsi logs into rageshakes (#22270)
Browse files Browse the repository at this point in the history
* Patch Jitsi logs into rageshakes

* Remove unused import

* Fix types
  • Loading branch information
robintown committed May 19, 2022
1 parent ff7398b commit d36dcd2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/vector/jitsi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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 }) => {
Expand All @@ -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, {});
}
});

Expand All @@ -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),
);
}

0 comments on commit d36dcd2

Please sign in to comment.