MCPcopy
hub / github.com/mifi/editly / validateArbitraryAudio

Function validateArbitraryAudio

parseConfig.js:21–35  ·  view source on GitHub ↗
(audio, allowRemoteRequests)

Source from the content-addressed store, hash-verified

19const loadedFonts = [];
20
21async function validateArbitraryAudio(audio, allowRemoteRequests) {
22 assert(audio === undefined || Array.isArray(audio));
23
24 if (audio) {
25 // eslint-disable-next-line no-restricted-syntax
26 for (const { path, cutFrom, cutTo, start } of audio) {
27 await assertFileValid(path, allowRemoteRequests);
28
29 if (cutFrom != null && cutTo != null) assert(cutTo > cutFrom);
30 if (cutFrom != null) assert(cutFrom >= 0);
31 if (cutTo != null) assert(cutTo >= 0);
32 assert(start == null || start >= 0, `Invalid "start" ${start}`);
33 }
34 }
35}
36
37export default async function parseConfig({ defaults: defaultsIn = {}, clips, arbitraryAudio: arbitraryAudioIn, backgroundAudioPath, backgroundAudioVolume, loopAudio, allowRemoteRequests, ffprobePath }) {
38 const defaults = {

Callers 1

parseConfigFunction · 0.85

Calls 1

assertFileValidFunction · 0.90

Tested by

no test coverage detected