diff --git a/package.json b/package.json index 4661761c..9f423852 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "classnames": "^2.3.1", "color-hash": "^2.0.1", "events": "^3.3.0", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#965f4fb13b4b36b26a3f4d7214cc7630d9f579a5", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#da5bc358f40e1e9de39d28aea072a9c38e356bda", "matrix-widget-api": "^1.0.0", "mermaid": "^8.13.8", "normalize.css": "^8.0.1", diff --git a/src/room/useLoadGroupCall.ts b/src/room/useLoadGroupCall.ts index a741b90b..4c7af1d0 100644 --- a/src/room/useLoadGroupCall.ts +++ b/src/room/useLoadGroupCall.ts @@ -21,7 +21,7 @@ import { GroupCallIntent, } from "matrix-js-sdk/src/webrtc/groupCall"; import { GroupCallEventHandlerEvent } from "matrix-js-sdk/src/webrtc/groupCallEventHandler"; -import { ClientEvent } from "matrix-js-sdk/src/client"; +import { logger } from "matrix-js-sdk/src/logger"; import type { MatrixClient } from "matrix-js-sdk/src/client"; import type { Room } from "matrix-js-sdk/src/models/room"; @@ -53,11 +53,11 @@ export const useLoadGroupCall = ( const waitPromise = new Promise((resolve) => { const onRoomEvent = async (room: Room) => { if (room.roomId === roomId) { - client.removeListener(ClientEvent.Room, onRoomEvent); + client.removeListener(GroupCallEventHandlerEvent.Room, onRoomEvent); resolve(room); } }; - client.on(ClientEvent.Room, onRoomEvent); + client.on(GroupCallEventHandlerEvent.Room, onRoomEvent); }); // race the promise with a timeout so we don't @@ -74,6 +74,7 @@ export const useLoadGroupCall = ( const fetchOrCreateRoom = async (): Promise => { try { const room = await client.joinRoom(roomIdOrAlias, { viaServers }); + logger.info(`Joined ${roomIdOrAlias}, waiting for Room event`); // wait for the room to come down the sync stream, otherwise // client.getRoom() won't return the room. return waitForRoom(room.roomId); @@ -100,7 +101,9 @@ export const useLoadGroupCall = ( const fetchOrCreateGroupCall = async (): Promise => { const room = await fetchOrCreateRoom(); + logger.debug(`Fetched / joined room ${roomIdOrAlias}`); const groupCall = client.getGroupCallForRoom(room.roomId); + logger.debug("Got group call", groupCall); if (groupCall) return groupCall; @@ -111,7 +114,11 @@ export const useLoadGroupCall = ( ) ) { // The call doesn't exist, but we can create it - console.log(`Creating ${createPtt ? "PTT" : "video"} group call room`); + console.log( + `No call found in ${roomIdOrAlias}: creating ${ + createPtt ? "PTT" : "video" + } call` + ); return await client.createGroupCall( room.roomId, createPtt ? GroupCallType.Voice : GroupCallType.Video, diff --git a/yarn.lock b/yarn.lock index 0e3d523e..7dda8797 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8390,9 +8390,9 @@ matrix-events-sdk@^0.0.1-beta.7: resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1-beta.7.tgz#5ffe45eba1f67cc8d7c2377736c728b322524934" integrity sha512-9jl4wtWanUFSy2sr2lCjErN/oC8KTAtaeaozJtrgot1JiQcEI4Rda9OLgQ7nLKaqb4Z/QUx/fR3XpDzm5Jy1JA== -"matrix-js-sdk@github:matrix-org/matrix-js-sdk#965f4fb13b4b36b26a3f4d7214cc7630d9f579a5": +"matrix-js-sdk@github:matrix-org/matrix-js-sdk#da5bc358f40e1e9de39d28aea072a9c38e356bda": version "19.3.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/965f4fb13b4b36b26a3f4d7214cc7630d9f579a5" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/da5bc358f40e1e9de39d28aea072a9c38e356bda" dependencies: "@babel/runtime" "^7.12.5" "@types/sdp-transform" "^2.4.5"