Removing room entry buffer before a Daily.co video call (#1902)

* 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 <lola.ojabowale@gmail.com>
Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/1920/head
Lola 2022-02-18 19:39:10 -05:00 committed by GitHub
parent b9dd90b998
commit 08e6059c8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 16 deletions

View File

@ -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.
<!-- LICENSE -->

View File

@ -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,
},
};
};

View File

@ -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) {
<div style={{ zIndex: 2, position: "relative" }}>
<Link href="/">
<img
className="fixed z-10 hidden h-5 w-auto sm:inline-block"
className="h-5·w-auto fixed z-10 hidden sm:inline-block"
src="https://cal.com/logo-white.svg"
alt="Cal.com Logo"
style={{