From 5502f588eb371bff17132ccd56973bccdb276e88 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 9 Feb 2024 11:22:36 -0500 Subject: [PATCH] Fix errors --- src/livekit/options.ts | 1 - src/livekit/useECConnectionState.ts | 10 +++++++--- src/livekit/useLiveKit.ts | 4 ++-- src/state/TileViewModel.ts | 2 +- yarn.lock | 9 +-------- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/livekit/options.ts b/src/livekit/options.ts index 00f19b12..5a8d4f10 100644 --- a/src/livekit/options.ts +++ b/src/livekit/options.ts @@ -59,5 +59,4 @@ export const defaultLiveKitOptions: RoomOptions = { stopLocalTrackOnUnpublish: true, reconnectPolicy: new DefaultReconnectPolicy(), disconnectOnPageLeave: true, - expWebAudioMix: false, }; diff --git a/src/livekit/useECConnectionState.ts b/src/livekit/useECConnectionState.ts index 17baf124..1ca3b675 100644 --- a/src/livekit/useECConnectionState.ts +++ b/src/livekit/useECConnectionState.ts @@ -61,7 +61,9 @@ async function doConnect( // doesn't publish it until you unmute. We want to publish it from the start so we're // always capturing audio: it helps keep bluetooth headsets in the right mode and // mobile browsers to know we're doing a call. - if (livekitRoom!.localParticipant.getTrack(Track.Source.Microphone)) { + if ( + livekitRoom!.localParticipant.getTrackPublication(Track.Source.Microphone) + ) { logger.warn( "Pre-creating audio track but participant already appears to have an microphone track: this shouldn't happen!", ); @@ -90,7 +92,9 @@ async function doConnect( if (!audioEnabled) await preCreatedAudioTrack?.mute(); // check again having awaited for the track to create - if (livekitRoom!.localParticipant.getTrack(Track.Source.Microphone)) { + if ( + livekitRoom!.localParticipant.getTrackPublication(Track.Source.Microphone) + ) { logger.warn( "Pre-created audio track but participant already appears to have an microphone track: this shouldn't happen!", ); @@ -174,7 +178,7 @@ export function useECConnectionState( const doFocusSwitch = useCallback(async (): Promise => { const screenshareTracks: MediaStreamTrack[] = []; - for (const t of livekitRoom!.localParticipant.videoTracks.values()) { + for (const t of livekitRoom!.localParticipant.videoTrackPublications.values()) { if (t.track && t.source == Track.Source.ScreenShare) { const newTrack = t.track.mediaStreamTrack.clone(); newTrack.enabled = true; diff --git a/src/livekit/useLiveKit.ts b/src/livekit/useLiveKit.ts index fb7a4297..f6858693 100644 --- a/src/livekit/useLiveKit.ts +++ b/src/livekit/useLiveKit.ts @@ -291,7 +291,7 @@ export function useLiveKit( room.options.audioCaptureDefaults?.deviceId === "default" ) { const activeMicTrack = Array.from( - room.localParticipant.audioTracks.values(), + room.localParticipant.audioTrackPublications.values(), ).find((d) => d.source === Track.Source.Microphone)?.track; const defaultDevice = device.available.find( @@ -313,7 +313,7 @@ export function useLiveKit( // Note that room.switchActiveDevice() won't work: Livekit will ignore it because // the deviceId hasn't changed (was & still is default). room.localParticipant - .getTrack(Track.Source.Microphone) + .getTrackPublication(Track.Source.Microphone) ?.audioTrack?.restartTrack(); } } else { diff --git a/src/state/TileViewModel.ts b/src/state/TileViewModel.ts index 791d28a3..1343fb38 100644 --- a/src/state/TileViewModel.ts +++ b/src/state/TileViewModel.ts @@ -56,7 +56,7 @@ function observeTrackReference( observeParticipantMedia(participant).pipe( map(() => ({ participant, - publication: participant.getTrack(source), + publication: participant.getTrackPublication(source), source, })), distinctUntilKeyChanged("publication"), diff --git a/yarn.lock b/yarn.lock index 122b3d06..5ea79e8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1706,14 +1706,7 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== -"@floating-ui/core@^1.5.3": - version "1.5.3" - resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.5.3.tgz#b6aa0827708d70971c8679a16cf680a515b8a52a" - integrity sha512-O0WKDOo0yhJuugCx6trZQj5jVJ9yR0ystG2JaNAemYUWce+pmM6WUEFIibnWyEJKdrDxhm75NoSRME35FNaM/Q== - dependencies: - "@floating-ui/utils" "^0.2.0" - -"@floating-ui/core@^1.6.0": +"@floating-ui/core@^1.5.3", "@floating-ui/core@^1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.0.tgz#fa41b87812a16bf123122bf945946bae3fdf7fc1" integrity sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g==