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 authored and GitHub committed 2025-03-13 12:46:10 -03:00
1 parent 6c01f5eace
commit 0e5a0bfa7b
3 files changed
+65 -9

No files matched your search

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