From ffb6b0a5f6789009546ef0f7f0815f9fe6b88de9 Mon Sep 17 00:00:00 2001 From: Valere Date: Mon, 27 Jul 2026 14:42:25 +0200 Subject: [PATCH] Use rtc transport action with widgets --- package.json | 2 +- pnpm-lock.yaml | 12 +++++- .../localMember/RtcTransportAutoDiscovery.ts | 39 +++++++------------ 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index b63acd348..121dd6dca 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "lodash-es": "^4.17.21", "loglevel": "^1.9.1", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", - "matrix-widget-api": "^1.16.1", + "matrix-widget-api": "^1.18.0", "node-stdlib-browser": "^1.3.1", "normalize.css": "^8.0.1", "observable-hooks": "^4.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2863b45bd..e69bf22cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -188,8 +188,8 @@ importers: specifier: github:matrix-org/matrix-js-sdk#develop version: https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8c95727b6278fe7942c20d0b9485f984dd0694b7 matrix-widget-api: - specifier: ^1.16.1 - version: 1.17.0 + specifier: ^1.18.0 + version: 1.18.0 node-stdlib-browser: specifier: ^1.3.1 version: 1.3.1 @@ -4864,6 +4864,9 @@ packages: matrix-widget-api@1.17.0: resolution: {integrity: sha512-5FHoo3iEP3Bdlv5jsYPWOqj+pGdFQNLWnJLiB0V7Ygne7bb+Gsj3ibyFyHWC6BVw+Z+tSW4ljHpO17I9TwStwQ==} + matrix-widget-api@1.18.0: + resolution: {integrity: sha512-4T2f2koWmx05p1BLcT/9YGGGPSXpPT+PA4Oap/5fjhXsWPxMGJiGL97YpANMYLKsnE1sScYFeuyxIgdc1Qo+Ew==} + md5.js@1.3.5: resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==} @@ -10609,6 +10612,11 @@ snapshots: '@types/events': 3.0.3 events: 3.3.0 + matrix-widget-api@1.18.0: + dependencies: + '@types/events': 3.0.3 + events: 3.3.0 + md5.js@1.3.5: dependencies: hash-base: 3.0.5 diff --git a/src/state/CallViewModel/localMember/RtcTransportAutoDiscovery.ts b/src/state/CallViewModel/localMember/RtcTransportAutoDiscovery.ts index e639cd3b5..b32b7b613 100644 --- a/src/state/CallViewModel/localMember/RtcTransportAutoDiscovery.ts +++ b/src/state/CallViewModel/localMember/RtcTransportAutoDiscovery.ts @@ -90,34 +90,23 @@ export class RtcTransportAutoDiscovery { private async tryBackendTransports(): Promise { const client = this.client; // MSC4143: Attempt to fetch transports from backend. - // TODO: Workaround for an issue in the js-sdk RoomWidgetClient that - // is not yet implementing _unstable_getRTCTransports properly (via widget API new action). - // For now we just skip this call if we are in a widget. - // In widget mode the client is a `RoomWidgetClient` which has no access token (it is using the widget API). - // Could be removed once the js-sdk is fixed (https://github.com/matrix-org/matrix-js-sdk/issues/5245) - const isSPA = !!client.getAccessToken(); - if (isSPA && "_unstable_getRTCTransports" in client) { - this.logger.info("First try to use getRTCTransports end point ..."); - try { - const transportList = await doNetworkOperationWithRetry(async () => - client._unstable_getRTCTransports(), + this.logger.info("First try to use getRTCTransports end point ..."); + try { + const transportList = await doNetworkOperationWithRetry(async () => + client._unstable_getRTCTransports() + ); + const first = transportList.find(isLivekitTransportConfig); + if (first) { + return first; + } else { + this.logger.info( + `No livekit transport found in getRTCTransports end point`, + transportList ); - const first = transportList.find(isLivekitTransportConfig); - if (first) { - return first; - } else { - this.logger.info( - `No livekit transport found in getRTCTransports end point`, - transportList, - ); - } - } catch (ex) { - this.logger.info(`Failed to use getRTCTransports end point: ${ex}`); } - } else { - this.logger.debug(`getRTCTransports end point not available`); + } catch (ex) { + this.logger.info(`Failed to use getRTCTransports end point: ${ex}`); } - return null; }