Skip to content

Commit 174a0f9

Browse files
committed
Fixed node environment regression. Fixed test script commands in package.json
1 parent 1c10c8b commit 174a0f9

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"wait": "rimraf dist && wait-on http://localhost:3000/dist/ffmpeg.dev.js",
1616
"test": "npm-run-all -p -r start test:all",
1717
"test:all": "npm-run-all wait test:browser:ffmpeg test:node:all",
18-
"test:node": "node --experimental-wasm-threads --experimental-wasm-bulk-memory node_modules/.bin/_mocha --exit --bail --require ./scripts/test-helper.js",
18+
"test:node": "node node_modules/mocha/bin/_mocha --exit --bail --require ./scripts/test-helper.js",
1919
"test:node:all": "npm run test:node -- ./tests/*.test.js",
2020
"test:browser": "mocha-headless-chrome -a allow-file-access-from-files -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000",
2121
"test:browser:ffmpeg": "npm run test:browser -- -f ./tests/ffmpeg.test.html"

src/createFFmpeg.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,17 @@ module.exports = (_options = {}) => {
7575
* as we are using blob URL instead of original URL to avoid cross origin issues.
7676
*/
7777
locateFile: (path, prefix) => {
78-
if (typeof wasmPath !== 'undefined'
79-
&& path.endsWith('ffmpeg-core.wasm')) {
80-
return wasmPath;
81-
}
82-
if (typeof workerPath !== 'undefined'
83-
&& path.endsWith('ffmpeg-core.worker.js')) {
84-
return workerPath;
78+
if (typeof window !== 'undefined' || typeof WorkerGlobalScope !== 'undefined') {
79+
if (typeof wasmPath !== 'undefined'
80+
&& path.endsWith('ffmpeg-core.wasm')) {
81+
return wasmPath;
82+
}
83+
if (typeof workerPath !== 'undefined'
84+
&& path.endsWith('ffmpeg-core.worker.js')) {
85+
return workerPath;
86+
}
8587
}
88+
return prefix + path;
8689
},
8790
});
8891
ffmpeg = Core.cwrap('proxy_main', 'number', ['number', 'number']);

0 commit comments

Comments
 (0)