From 08e6059c8d9728b93328b08c4361aef7cb1e9174 Mon Sep 17 00:00:00 2001 From: Lola <68611399+lunchpaillola@users.noreply.github.com> Date: Fri, 18 Feb 2022 19:39:10 -0500 Subject: [PATCH] Removing room entry buffer before a Daily.co video call (#1902) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * initial * scale plan instructions in the readme and removed the buffer for entering a video call * readme update for Daily Scale Plan users Co-authored-by: Lola-Ojabowale Co-authored-by: Omar López Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- README.md | 1 + .../integrations/Daily/DailyVideoApiAdapter.ts | 5 +---- apps/web/pages/video/[uid].tsx | 16 ++++------------ 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 24fe118c..c4600e9f 100644 --- a/README.md +++ b/README.md @@ -334,6 +334,7 @@ Contributions are what make the open source community such an amazing place to b 2. From within your dashboard, go to the [developers](https://dashboard.daily.co/developers) tab. 3. Copy your API key. 4. Now paste the API key to your .env file into the `DAILY_API_KEY` field in your .env file. +5. If you have the [Daily Scale Plan](https://www.daily.co/pricing) set the `DAILY_SCALE_PLAN` variable to `true` in order to use features like video recording. diff --git a/apps/web/lib/integrations/Daily/DailyVideoApiAdapter.ts b/apps/web/lib/integrations/Daily/DailyVideoApiAdapter.ts index 5d3d408b..03e34055 100644 --- a/apps/web/lib/integrations/Daily/DailyVideoApiAdapter.ts +++ b/apps/web/lib/integrations/Daily/DailyVideoApiAdapter.ts @@ -102,9 +102,8 @@ const DailyVideoApiAdapter = (credential: Credential): VideoApiAdapter => { const translateEvent = (event: CalendarEvent) => { // Documentation at: https://docs.daily.co/reference#list-rooms - // added a 1 hour buffer for room expiration and room entry + // added a 1 hour buffer for room expiration const exp = Math.round(new Date(event.endTime).getTime() / 1000) + 60 * 60; - const nbf = Math.round(new Date(event.startTime).getTime() / 1000) - 60 * 60; const scalePlan = process.env.DAILY_SCALE_PLAN; if (scalePlan === "true") { @@ -117,7 +116,6 @@ const DailyVideoApiAdapter = (credential: Credential): VideoApiAdapter => { enable_screenshare: true, enable_chat: true, exp: exp, - nbf: nbf, enable_recording: "local", }, }; @@ -131,7 +129,6 @@ const DailyVideoApiAdapter = (credential: Credential): VideoApiAdapter => { enable_screenshare: true, enable_chat: true, exp: exp, - nbf: nbf, }, }; }; diff --git a/apps/web/pages/video/[uid].tsx b/apps/web/pages/video/[uid].tsx index 2c7319eb..488dc0d4 100644 --- a/apps/web/pages/video/[uid].tsx +++ b/apps/web/pages/video/[uid].tsx @@ -20,27 +20,19 @@ export default function JoinCall(props: JoinCallPageProps) { //if no booking redirectis to the 404 page const emptyBooking = props.booking === null; - //daily.co calls have a 60 minute exit and entry buffer when a user enters a call when it's not available it will trigger the modals + //daily.co calls have a 60 minute exit buffer when a user enters a call when it's not available it will trigger the modals const now = new Date(); - const enterDate = new Date(now.getTime() + 60 * 60 * 1000); const exitDate = new Date(now.getTime() - 60 * 60 * 1000); - console.log(enterDate); - - //find out if the meeting is upcoming or in the past + //find out if the meeting is in the past const isPast = new Date(props.booking?.endTime || "") <= exitDate; - const isUpcoming = new Date(props.booking?.startTime || "") >= enterDate; - const meetingUnavailable = isUpcoming == true || isPast == true; + const meetingUnavailable = isPast == true; useEffect(() => { if (emptyBooking) { router.push("/video/no-meeting-found"); } - if (isUpcoming) { - router.push(`/video/meeting-not-started/${props.booking?.uid}`); - } - if (isPast) { router.push(`/video/meeting-ended/${props.booking?.uid}`); } @@ -126,7 +118,7 @@ export default function JoinCall(props: JoinCallPageProps) {