Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency @livekit/components-react to v1.4.1 #1923

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/livekit/MediaDevicesContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from "react";
import { createMediaDeviceObserver } from "@livekit/components-core";
import { Observable } from "rxjs";
import { logger } from "matrix-js-sdk/src/logger";

import {
isFirefox,
Expand Down Expand Up @@ -82,21 +83,31 @@ function useMediaDevice(
// Tragically, the only way to get device names out of LiveKit is to specify a
// kind, which then results in multiple permissions requests.
const deviceObserver = useMemo(
() => createMediaDeviceObserver(kind, requestPermissions),
() =>
createMediaDeviceObserver(
kind,
() => {
logger.error("Error creating MediaDeviceObserver");
},
requestPermissions,
),
[kind, requestPermissions],
);
const available = useObservableState(deviceObserver, []);
const [selectedId, select] = useState(fallbackDevice);

return useMemo(() => {
const devId = available.some((d) => d.deviceId === selectedId)
? selectedId
: available.some((d) => d.deviceId === fallbackDevice)
? fallbackDevice
: available.at(0)?.deviceId;
let devId;
if (available) {
devId = available.some((d) => d.deviceId === selectedId)
? selectedId
: available.some((d) => d.deviceId === fallbackDevice)
? fallbackDevice
: available.at(0)?.deviceId;
}

return {
available,
available: available ?? [],
selectedId: alwaysDefault ? undefined : devId,
select,
};
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1989,22 +1989,22 @@
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.0":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@livekit/components-core/-/components-core-0.8.0.tgz#6c20fff1459624e78fe72abd4a46151e31d5e3d8"
integrity sha512-nfJO5BBKR1hvkImsErxl7EwSJMXcZ0xSpHT42sevUeL5VKVYUj5YJFuhOs/xUMx06kBSDNMGHNsjRvbYgLFv0w==
"@livekit/components-core@0.8.1":
version "0.8.1"
resolved "https://registry.yarnpkg.com/@livekit/components-core/-/components-core-0.8.1.tgz#40efb867c9fc5c9c3ee37055fb307a3ed41b24ed"
integrity sha512-0pe+xRIuDObJNGv9Khn+RxHVGL2bit45ORLu+u3UoiAEt1V+pR2XldN6lW6pChuEBY1KLUuuS3h1EbcxrIkYOw==
dependencies:
"@floating-ui/dom" "^1.1.0"
email-regex "^5.0.0"
loglevel "^1.8.1"
rxjs "^7.8.0"

"@livekit/components-react@^1.1.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@livekit/components-react/-/components-react-1.4.0.tgz#c57621e3a27f3a758aafb7a66abe7b5f22a94e7f"
integrity sha512-hcJWM/E9rqa1KH76nLVlbL6twM5W/xUwobSOGwklCxih4D575qd9XWB3hlOHqHL0h1FIvzuhOJgyJ8NXoRpucA==
version "1.4.1"
resolved "https://registry.yarnpkg.com/@livekit/components-react/-/components-react-1.4.1.tgz#c17e2ad4162d492ebdb5827a9f9b71d908b61322"
integrity sha512-k8zJhr9JfYqClhR6mifpH0z7pO1imKu3/ytjG2P6L1GM4SYT3GGOJV3TPwrNn35glHY2TveHvHjWLh7JHiNF3w==
dependencies:
"@livekit/components-core" "0.8.0"
"@livekit/components-core" "0.8.1"
"@react-hook/latest" "^1.0.3"
clsx "^2.0.0"
usehooks-ts "^2.9.1"
Expand Down