Browse Source

Support remote input files over http

pull/61/head
Johnathan Amit-Kanarek 6 years ago
parent
commit
fecceb87b6
  1. 6
      index.js

6
index.js

@ -19,7 +19,7 @@ const loadedFonts = [];
// See #16 // See #16
const checkTransition = (transition) => assert(transition == null || typeof transition === 'object', 'Transition must be an object'); const checkTransition = (transition) => assert(transition == null || typeof transition === 'object', 'Transition must be an object');
const assertFileExists = async (path) => assert(await fs.exists(path), `File does not exist ${path}`);
const assertFileExists = async (path, enableRemote) => assert((enableRemote && path.startsWith('http')) || await fs.exists(path), `File does not exist ${path}`);
module.exports = async (config = {}) => { module.exports = async (config = {}) => {
@ -52,7 +52,7 @@ module.exports = async (config = {}) => {
const audioFilePath = isGif ? undefined : audioFilePathIn; const audioFilePath = isGif ? undefined : audioFilePathIn;
if (audioFilePath) await assertFileExists(audioFilePath);
if (audioFilePath) await assertFileExists(audioFilePath, true);
checkTransition(defaultsIn.transition); checkTransition(defaultsIn.transition);
@ -76,7 +76,7 @@ module.exports = async (config = {}) => {
// https://github.com/mifi/editly/issues/39 // https://github.com/mifi/editly/issues/39
if (type === 'image') { if (type === 'image') {
await assertFileExists(restLayer.path);
await assertFileExists(restLayer.path, true);
} else if (type === 'gl') { } else if (type === 'gl') {
await assertFileExists(restLayer.fragmentPath); await assertFileExists(restLayer.fragmentPath);
} }

Loading…
Cancel
Save