From e4fee457cf8972713b86758c3743dbfdf9207b3b Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 8 Dec 2025 09:41:01 +0100 Subject: [PATCH] allow to use custom applications --- sdk/index.html | 4 +++- sdk/main.ts | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sdk/index.html b/sdk/index.html index f90312f1..51110ebd 100644 --- a/sdk/index.html +++ b/sdk/index.html @@ -8,7 +8,9 @@ import { createMatrixRTCSdk } from "http://localhost:8123/matrixrtc-sdk.js"; try { - window.matrixRTCSdk = await createMatrixRTCSdk(); + window.matrixRTCSdk = await createMatrixRTCSdk( + "com.github.toger5.godot-game", + ); console.info("createMatrixRTCSdk was created!"); } catch (e) { console.error("createMatrixRTCSdk", e); diff --git a/sdk/main.ts b/sdk/main.ts index c9a46df9..1dfbbcbf 100644 --- a/sdk/main.ts +++ b/sdk/main.ts @@ -30,7 +30,9 @@ import { } from "rxjs"; import { type CallMembership, + MatrixRTCSession, MatrixRTCSessionEvent, + SlotDescription, } from "matrix-js-sdk/lib/matrixrtc"; import { type Room as LivekitRoom, @@ -80,7 +82,10 @@ interface MatrixRTCSdk { sendData?: (data: unknown) => Promise; } -export async function createMatrixRTCSdk(): Promise { +export async function createMatrixRTCSdk( + application: string = "m.call", + id: string = "", +): Promise { logger.info("Hello"); const client = await widget.client; logger.info("client created"); @@ -93,7 +98,10 @@ export async function createMatrixRTCSdk(): Promise { const mediaDevices = new MediaDevices(scope); const muteStates = new MuteStates(scope, mediaDevices, constant(true)); - const rtcSession = client.matrixRTC.getRoomSession(room); + const rtcSession = new MatrixRTCSession(client, room, { + application, + id, + }); const callViewModel = createCallViewModel$( scope, rtcSession,