Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add maxRetries option to probeVideoViaMediaServer

Richie McIlroy797881844eec
diff --git a/apps/web/lib/media-client.ts b/apps/web/lib/media-client.ts
index 4f3464b74..bf8bc6234 100644
--- a/apps/web/lib/media-client.ts
+++ b/apps/web/lib/media-client.ts
@@ -189,16 +189,25 @@ export interface MediaServerProbeResult {
fileSize: number;
}
+export interface ProbeVideoViaMediaServerOptions {
+ maxRetries?: number;
+}
+
export async function probeVideoViaMediaServer(
videoUrl: string,
+ options: ProbeVideoViaMediaServerOptions = {},
): Promise<MediaServerProbeResult> {
const { mediaServerUrl, mediaServerSecret } = getMediaServerConfig();
- const response = await fetchWithRetry(`${mediaServerUrl}/video/probe`, {
- method: "POST",
- headers: getMediaServerHeaders(mediaServerSecret),
- body: JSON.stringify({ videoUrl }),
- });
+ const response = await fetchWithRetry(
+ `${mediaServerUrl}/video/probe`,
+ {
+ method: "POST",
+ headers: getMediaServerHeaders(mediaServerSecret),
+ body: JSON.stringify({ videoUrl }),
+ },
+ { maxRetries: options.maxRetries },
+ );
if (!response.ok) {
let errorData: MediaServerError;