Skip to content

Commit 63f50e0

Browse files
committed
feat(web): add fetchConvertedVideoViaMediaServer client
Made-with: Cursor
1 parent b3bf980 commit 63f50e0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

apps/web/lib/media-client.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,22 @@ export async function convertAudioToMp3ViaMediaServer(
223223
const arrayBuffer = await response.arrayBuffer();
224224
return Buffer.from(arrayBuffer);
225225
}
226+
227+
export async function fetchConvertedVideoViaMediaServer(
228+
videoUrl: string,
229+
inputExtension?: string,
230+
): Promise<Response> {
231+
const mediaServerUrl = serverEnv().MEDIA_SERVER_URL;
232+
if (!mediaServerUrl) {
233+
throw new Error("MEDIA_SERVER_URL is not configured");
234+
}
235+
236+
return await fetchWithRetry(`${mediaServerUrl}/video/convert`, {
237+
method: "POST",
238+
headers: { "Content-Type": "application/json" },
239+
body: JSON.stringify({
240+
videoUrl,
241+
...(inputExtension ? { inputExtension } : {}),
242+
}),
243+
});
244+
}

0 commit comments

Comments
 (0)