feat: store cal video recording on s3 (#17050)

* feat: store cal video recording on s3

* fix: type error

* chore: update name and add condition
This commit is contained in:
Udit Takkar
2025-03-13 12:46:10 -03:00
committed by GitHub
parent 6c01f5eace
commit 0e5a0bfa7b
3 changed files with 65 additions and 9 deletions
+6
View File
@@ -17,6 +17,7 @@
#
# To enable enterprise-only features please add your environment variable to the .env file then make your way to /auth/setup to select your license and follow instructions.
CALCOM_LICENSE_KEY=
# Signature token for the Cal.com License API (used for self-hosted integrations)
# We will give you a token when we provide you with a license key this ensure you and only you can communicate with the Cal.com License API for your license key
@@ -405,6 +406,11 @@ NEXT_PUBLIC_WEBSITE_TERMS_URL=
# [0: silly & upwards, 1: trace & upwards, 2: debug & upwards, 3: info & upwards, 4: warn & upwards, 5: error & fatal, 6: fatal]
NEXT_PUBLIC_LOGGER_LEVEL=
# For storing Daily Video recordings on S3 Bucket
CAL_VIDEO_BUCKET_NAME=
CAL_VIDEO_BUCKET_REGION=
CAL_VIDEO_ASSUME_ROLE_ARN=
# Used to use Replexica SDK, a tool for real-time AI-powered localization
REPLEXICA_API_KEY=
@@ -42,6 +42,11 @@ export interface DailyVideoCallData {
url: string;
}
const isS3StorageEnabled =
process.env.CAL_VIDEO_BUCKET_NAME &&
process.env.CAL_VIDEO_BUCKET_REGION &&
process.env.CAL_VIDEO_ASSUME_ROLE_ARN;
/** @deprecated use metadata on index file */
export const FAKE_DAILY_CREDENTIAL: CredentialForCalendarService & { invalid: boolean } = {
id: 0,
@@ -233,6 +238,9 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
},
});
const enableRecording = scalePlan === "true" && !!hasTeamPlan === true ? "cloud" : undefined;
const isTranscriptionEnabled = !!hasTeamPlan;
return {
privacy: "public",
properties: {
@@ -242,13 +250,32 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
enable_chat: true,
enable_pip_ui: true,
exp: exp,
enable_recording: scalePlan === "true" && !!hasTeamPlan === true ? "cloud" : undefined,
enable_transcription_storage: !!hasTeamPlan,
...(!!hasTeamPlan && {
enable_recording: enableRecording,
...(!!enableRecording &&
isS3StorageEnabled && {
recordings_bucket: {
bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
allow_api_access: true,
allow_streaming_from_bucket: true,
},
}),
enable_transcription_storage: isTranscriptionEnabled,
...(isTranscriptionEnabled && {
permissions: {
canAdmin: ["transcription"],
},
}),
...(isTranscriptionEnabled &&
isS3StorageEnabled && {
transcription_bucket: {
bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
allow_api_access: true,
},
}),
},
};
};
@@ -260,6 +287,8 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
const isScalePlanTrue = scalePlan === "true";
const enableRecording = isScalePlanTrue ? "cloud" : undefined;
const body = {
privacy: "public",
properties: {
@@ -269,14 +298,31 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
enable_chat: true,
enable_pip_ui: true,
exp: exp,
enable_recording: isScalePlanTrue ? "cloud" : undefined,
enable_recording: enableRecording,
...(!!enableRecording &&
isS3StorageEnabled && {
recordings_bucket: {
bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
allow_api_access: true,
allow_streaming_from_bucket: true,
},
}),
start_video_off: true,
enable_transcription_storage: isScalePlanTrue,
...(!!isScalePlanTrue && {
permissions: {
canAdmin: ["transcription"],
},
}),
...(isScalePlanTrue &&
isS3StorageEnabled && {
permissions: {
canAdmin: ["transcription"],
},
transcription_bucket: {
bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
allow_api_access: true,
},
}),
},
};
+4
View File
@@ -454,6 +454,10 @@
"NEXT_PUBLIC_ORG_SELF_SERVE_ENABLED",
"NEXT_PUBLIC_API_V2_ROOT_URL",
"NEXT_PUBLIC_VAPID_PUBLIC_KEY",
"VAPID_PRIVATE_KEY",
"CAL_VIDEO_BUCKET_NAME",
"CAL_VIDEO_BUCKET_REGION",
"CAL_VIDEO_ASSUME_ROLE_ARN",
"NEXT_PUBLIC_POSTHOG_KEY",
"NEXT_PUBLIC_POSTHOG_HOST",
"VAPID_PRIVATE_KEY",