diff --git a/package.json b/package.json index 4c443f22..06a3bc1a 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ }, "dependencies": { "@juggle/resize-observer": "^3.3.1", - "@livekit/components-core": "^0.8.0", - "@livekit/components-react": "^1.1.0", + "@livekit/components-core": "^0.9.0", + "@livekit/components-react": "^2.0.0", "@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz", "@opentelemetry/api": "^1.4.0", "@opentelemetry/context-zone": "^1.9.1", @@ -60,7 +60,7 @@ "i18next": "^23.0.0", "i18next-browser-languagedetector": "^7.0.0", "i18next-http-backend": "^2.0.0", - "livekit-client": "1.15.12", + "livekit-client": "^2.0.2", "lodash": "^4.17.21", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#99600e87f193508ad56325baf2bb134110f3905a", "matrix-widget-api": "^1.3.1", 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 b059c42c..59c48bdc 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 2caf4874..44ac9aab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1113,9 +1113,9 @@ to-fast-properties "^2.0.0" "@bufbuild/protobuf@^1.3.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.6.0.tgz#c33128f70330312e2bd78fd7e988576595b8f74d" - integrity sha512-hp19vSFgNw3wBBcVBx5qo5pufCqjaJ0Cfk5H/pfjNOfNWU+4/w0QVOmfAOZNRrNWRrVuaJWxcN8P2vhOkkzbBQ== + version "1.7.2" + resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.7.2.tgz#1b3d6c66ebd987f7da7f1e3f0546cffaa87f8732" + integrity sha512-i5GE2Dk5ekdlK1TR7SugY4LWRrKSfb5T1Qn4unpIMbfxoeGKERKQ59HG3iYewacGD10SR7UzevfPnh6my4tNmQ== "@csstools/cascade-layer-name-parser@^1.0.5": version "1.0.5" @@ -1642,13 +1642,6 @@ 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": version "1.6.0" resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.0.tgz#fa41b87812a16bf123122bf945946bae3fdf7fc1" @@ -1656,15 +1649,7 @@ dependencies: "@floating-ui/utils" "^0.2.1" -"@floating-ui/dom@1.5.4": - version "1.5.4" - resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.5.4.tgz#28df1e1cb373884224a463235c218dcbd81a16bb" - integrity sha512-jByEsHIY+eEdCjnTVu+E3ephzTOzkQ8hgUfGwos+bg7NlH33Zc5uO+QHz1mrQUOgIKKDD1RtS201P9NvAfq3XQ== - dependencies: - "@floating-ui/core" "^1.5.3" - "@floating-ui/utils" "^0.2.0" - -"@floating-ui/dom@^1.6.1": +"@floating-ui/dom@1.6.1", "@floating-ui/dom@^1.6.1": version "1.6.1" resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.1.tgz#d552e8444f77f2d88534372369b3771dc3a2fa5d" integrity sha512-iA8qE43/H5iGozC3W0YSnVSW42Vh522yyM1gj+BqRwVsTNOyr231PsXDaV04yT39PsO0QL2QpbI/M0ZaLUQgRQ== @@ -1679,7 +1664,7 @@ dependencies: "@floating-ui/dom" "^1.6.1" -"@floating-ui/utils@^0.2.0", "@floating-ui/utils@^0.2.1": +"@floating-ui/utils@^0.2.1": version "0.2.1" resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2" integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q== @@ -1815,25 +1800,25 @@ resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA== -"@livekit/components-core@0.8.3", "@livekit/components-core@^0.8.0": - version "0.8.3" - resolved "https://registry.yarnpkg.com/@livekit/components-core/-/components-core-0.8.3.tgz#631994f21245e892bd155296ff381796095a3b17" - integrity sha512-xwHjE7B4oQmhL3Nme7HKR5X71D5SaG0PbM750VpFOkdMkD6fhiouiblDc4/Ys0yK1iLFUAM8lXq/jBzU+xf2ZA== +"@livekit/components-core@0.9.0", "@livekit/components-core@^0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@livekit/components-core/-/components-core-0.9.0.tgz#9b948d3d0120418ae78e570e0bea1750b9379afd" + integrity sha512-CNDBkJLWiNciFJtrmYrjJfU9ToVzs9ubR24VPa9ekb/jYeJxxq4zKbudIaTeppUzcfGenkS6O6RgcyWjFVbpCw== dependencies: - "@floating-ui/dom" "1.5.4" + "@floating-ui/dom" "1.6.1" email-regex "5.0.0" - loglevel "1.8.1" + loglevel "1.9.1" rxjs "7.8.1" -"@livekit/components-react@^1.1.0": - version "1.5.3" - resolved "https://registry.yarnpkg.com/@livekit/components-react/-/components-react-1.5.3.tgz#e26a3bccbc7ff978e7ae89fc439c36c56faef9e1" - integrity sha512-OL2BhyltXz4GTEmTPZPMehBMoWWNILTqHClPpFLJyM3KLnk2lLvaH9QWwlbqIJVr6vkm39pvq39ckv6GKa7jJw== +"@livekit/components-react@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@livekit/components-react/-/components-react-2.0.0.tgz#9c46a440cf48acbe46eeefe24b8f0dca5fe856e7" + integrity sha512-trgOAmnIXok/VqWTHG3pbjCKy/wiZA1ZTFFbHOnRz4gpMf7s7lRWqyreF1BjcIQPKXwgF6lMWQTRjgCAqRuU+A== dependencies: - "@livekit/components-core" "0.8.3" + "@livekit/components-core" "0.9.0" "@react-hook/latest" "1.0.3" clsx "2.1.0" - usehooks-ts "2.9.1" + usehooks-ts "2.14.0" "@matrix-org/matrix-sdk-crypto-wasm@^4.1.0": version "4.1.0" @@ -6327,10 +6312,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -livekit-client@1.15.12: - version "1.15.12" - resolved "https://registry.yarnpkg.com/livekit-client/-/livekit-client-1.15.12.tgz#426c6c1d5e1b0d0bf01b742980fd5448da0d9b6f" - integrity sha512-1mjVFNOkF7f0HHAY1Z9zZw38eCxA2xCULah5z8whPkb61kG4LJU0aNCo9LWjAynO4ODLjfq2+fZvZoCHIya+6A== +livekit-client@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/livekit-client/-/livekit-client-2.0.2.tgz#162c42b621c4a5f6ea0d3ea33cd86ae416cc6567" + integrity sha512-NGMLTQth0y0fFy+MJyxC9WSAhcbuJZ5slOe3zbDhVtw/zUDwvCMDFeFHSL27yIshISiQviLRbh2rNLjou+beZQ== dependencies: "@bufbuild/protobuf" "^1.3.0" events "^3.3.0" @@ -6385,7 +6370,12 @@ lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -loglevel@1.8.1, loglevel@^1.7.1, loglevel@^1.8.0: +loglevel@1.9.1, loglevel@^1.8.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.9.1.tgz#d63976ac9bcd03c7c873116d41c2a85bafff1be7" + integrity sha512-hP3I3kCrDIMuRwAwHltphhDM1r8i55H33GgqjXbrisuJhF4kRhW1dNuxsRklp4bXl8DSdLaNLuiL4A/LWRfxvg== + +loglevel@^1.7.1: version "1.8.1" resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.8.1.tgz#5c621f83d5b48c54ae93b6156353f555963377b4" integrity sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg== @@ -8591,10 +8581,12 @@ use-sync-external-store@^1.0.0: resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== -usehooks-ts@2.9.1: - version "2.9.1" - resolved "https://registry.yarnpkg.com/usehooks-ts/-/usehooks-ts-2.9.1.tgz#953d3284851ffd097432379e271ce046a8180b37" - integrity sha512-2FAuSIGHlY+apM9FVlj8/oNhd+1y+Uwv5QNkMQz1oSfdHk4PXo1qoCw9I5M7j0vpH8CSWFJwXbVPeYDjLCx9PA== +usehooks-ts@2.14.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/usehooks-ts/-/usehooks-ts-2.14.0.tgz#8c38fdb9133a7278f88ff8c762695ccaec4abfb8" + integrity sha512-jnhrjTRJoJS7cFxz63tRYc5mzTKf/h+Ii8P0PDHymT9qDe4ZA2/gzDRmDR4WGausg5X8wMIdghwi3BBCN9JKow== + dependencies: + lodash.debounce "^4.0.8" util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2"