MCPcopy Index your code
hub / github.com/CapSoftware/Cap / probeVideoOnMediaServer

Function probeVideoOnMediaServer

apps/web/workflows/edit-video.ts:384–414  ·  view source on GitHub ↗
(
	mediaServerUrl: string,
	videoUrl: string,
	webhookSecret: string | undefined,
)

Source from the content-addressed store, hash-verified

382}
383
384async function probeVideoOnMediaServer(
385 mediaServerUrl: string,
386 videoUrl: string,
387 webhookSecret: string | undefined,
388): Promise<VideoEditRenderResult["metadata"]> {
389 const headers: Record<string, string> = {
390 "Content-Type": "application/json",
391 };
392 if (webhookSecret) {
393 headers["x-media-server-secret"] = webhookSecret;
394 }
395
396 const response = await fetch(`${mediaServerUrl}/video/probe`, {
397 method: "POST",
398 headers,
399 body: JSON.stringify({ videoUrl }),
400 });
401
402 if (!response.ok) {
403 const errorData = (await response.json().catch(() => ({}))) as {
404 error?: string;
405 details?: string;
406 };
407 throw new Error(
408 errorData.error || errorData.details || "Rendered video probe failed",
409 );
410 }
411
412 const { metadata } = (await response.json()) as VideoEditRenderResult;
413 return metadata;
414}
415
416async function verifyRenderedEditOutput(
417 videoId: string,

Callers 1

verifyRenderedEditOutputFunction · 0.85

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected