MCPcopy Index your code
hub / github.com/callstack/agent-device / isPlayableVideo

Function isPlayableVideo

src/utils/video.ts:66–87  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

64}
65
66export async function isPlayableVideo(filePath: string): Promise<boolean> {
67 try {
68 const validatorPath = await getVideoValidatorExecutablePath();
69 const result = await runCmd(validatorPath, [filePath], {
70 allowFailure: true,
71 timeoutMs: 10_000,
72 env: buildSwiftToolEnv(),
73 });
74 if (result.exitCode === 0) {
75 return true;
76 }
77 if (isSwiftVideoValidatorUnavailable(result.stderr, result.stdout)) {
78 return hasLikelyPlayableVideoContainer(filePath);
79 }
80 return false;
81 } catch (error) {
82 if (isSwiftVideoValidatorError(error)) {
83 return hasLikelyPlayableVideoContainer(filePath);
84 }
85 throw error;
86 }
87}
88
89async function getVideoValidatorExecutablePath(): Promise<string> {
90 videoValidatorExecutablePathPromise ??= compileSwiftSourceText({

Callers 1

waitForPlayableVideoFunction · 0.85

Calls 6

runCmdFunction · 0.90
buildSwiftToolEnvFunction · 0.90

Tested by

no test coverage detected