diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts new file mode 100644 index 00000000..7b9c1d9d --- /dev/null +++ b/src/@types/global.d.ts @@ -0,0 +1,17 @@ +/* +Copyright 2022 Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import "matrix-js-sdk/src/@types/global"; diff --git a/src/room/usePTT.ts b/src/room/usePTT.ts index 48c69c4a..24d364c2 100644 --- a/src/room/usePTT.ts +++ b/src/room/usePTT.ts @@ -16,11 +16,8 @@ limitations under the License. import { useCallback, useEffect, useState } from "react"; import { MatrixClient } from "matrix-js-sdk/src/client"; -// XXX: This must come after the other js-sdk import because of -// https://github.com/matrix-org/matrix-js-sdk/issues/2351 -import "matrix-js-sdk/src/@types/global"; import { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall"; -import { CallFeed } from "matrix-js-sdk/src/webrtc/callFeed"; +import { CallFeed, CallFeedEvent } from "matrix-js-sdk/src/webrtc/callFeed"; export interface PTTState { pttButtonHeld: boolean; @@ -74,7 +71,7 @@ export const usePTT = ( } for (const callFeed of userMediaFeeds) { - callFeed.addListener("mute_state_changed", onMuteStateChanged); + callFeed.addListener(CallFeedEvent.MuteStateChanged, onMuteStateChanged); } const activeSpeakerFeed = userMediaFeeds.find((f) => !f.isAudioMuted()); @@ -86,7 +83,10 @@ export const usePTT = ( return () => { for (const callFeed of userMediaFeeds) { - callFeed.removeListener("mute_state_changed", onMuteStateChanged); + callFeed.removeListener( + CallFeedEvent.MuteStateChanged, + onMuteStateChanged + ); } }; }, [userMediaFeeds]);