( mediaServerUrl: string, videoUrl: string, webhookSecret: string | undefined, )
| 382 | } |
| 383 | |
| 384 | async 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 | |
| 416 | async function verifyRenderedEditOutput( |
| 417 | videoId: string, |
no test coverage detected