Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add fetchConvertedVideoViaMediaServer client

Richie McIlroy63f50e0b5637
diff --git a/apps/web/lib/media-client.ts b/apps/web/lib/media-client.ts
index e6613b267..fc48f04d3 100644
--- a/apps/web/lib/media-client.ts
+++ b/apps/web/lib/media-client.ts
@@ -223,3 +223,22 @@ export async function convertAudioToMp3ViaMediaServer(
const arrayBuffer = await response.arrayBuffer();
return Buffer.from(arrayBuffer);
}
+
+export async function fetchConvertedVideoViaMediaServer(
+ videoUrl: string,
+ inputExtension?: string,
+): Promise<Response> {
+ const mediaServerUrl = serverEnv().MEDIA_SERVER_URL;
+ if (!mediaServerUrl) {
+ throw new Error("MEDIA_SERVER_URL is not configured");
+ }
+
+ return await fetchWithRetry(`${mediaServerUrl}/video/convert`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ videoUrl,
+ ...(inputExtension ? { inputExtension } : {}),
+ }),
+ });
+}