From 1935693ab6ab3980721b7305ae3f923538548539 Mon Sep 17 00:00:00 2001 From: James Hush Date: Tue, 19 Mar 2024 21:42:38 +0800 Subject: [PATCH 1/2] Check if permission is granted --- src/App.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c834e42..638e3f7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import Daily, { DailyEventObject } from "@daily-co/daily-js"; import { @@ -31,7 +31,7 @@ export default function App() { const [inputSettingsUpdated, setInputSettingsUpdated] = useState(false); const [enableBlurClicked, setEnableBlurClicked] = useState(false); const [enableBackgroundClicked, setEnableBackgroundClicked] = useState(false); - const [dailyRoomUrl, setDailyRoomUrl] = useState(""); + const [dailyRoomUrl, setDailyRoomUrl] = useState("https://hush.daily.co/sfu"); const [dailyMeetingToken, setDailyMeetingToken] = useState(""); const { @@ -254,6 +254,8 @@ export default function App() { const participantCounts = hidden + present; + const isPermissionGranted = String(cameras.length + microphones.length > 0); + return ( <>
@@ -360,6 +362,7 @@ export default function App() { Start Transcription +

Mic/Cam Permission Granted: {isPermissionGranted}

{participantIds.map((id) => ( From c135fc68b082b44cefa76f2628cb93a82bfd01b4 Mon Sep 17 00:00:00 2001 From: James Hush Date: Tue, 19 Mar 2024 21:43:29 +0800 Subject: [PATCH 2/2] Simplify code --- src/App.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 638e3f7..e25ca6d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useState } from "react"; +import React, { useCallback, useState } from "react"; import Daily, { DailyEventObject } from "@daily-co/daily-js"; import { @@ -31,7 +31,7 @@ export default function App() { const [inputSettingsUpdated, setInputSettingsUpdated] = useState(false); const [enableBlurClicked, setEnableBlurClicked] = useState(false); const [enableBackgroundClicked, setEnableBackgroundClicked] = useState(false); - const [dailyRoomUrl, setDailyRoomUrl] = useState("https://hush.daily.co/sfu"); + const [dailyRoomUrl, setDailyRoomUrl] = useState(""); const [dailyMeetingToken, setDailyMeetingToken] = useState(""); const {