use multi-threading if not chrome
This commit is contained in:
parent
99b4143dd6
commit
5d0663eb12
|
@ -9,7 +9,8 @@
|
||||||
import { fetchFile, toBlobURL } from "@ffmpeg/util";
|
import { fetchFile, toBlobURL } from "@ffmpeg/util";
|
||||||
import { dndzone } from "svelte-dnd-action";
|
import { dndzone } from "svelte-dnd-action";
|
||||||
|
|
||||||
const baseURL = "https://unpkg.com/@ffmpeg/core@0.12.2/dist/esm";
|
const isChrome = navigator.userAgent.match(/chrome|chromium|crios/i);
|
||||||
|
const baseURL = `https://unpkg.com/@ffmpeg/core${!isChrome ? "-mt" : ""}@0.12.2/dist/esm`;
|
||||||
// const baseURL = "";
|
// const baseURL = "";
|
||||||
const TIMEOUT = 40000;
|
const TIMEOUT = 40000;
|
||||||
|
|
||||||
|
@ -62,11 +63,19 @@
|
||||||
logbox.scrollTop = logbox.scrollHeight;
|
logbox.scrollTop = logbox.scrollHeight;
|
||||||
// message = msg;
|
// message = msg;
|
||||||
});
|
});
|
||||||
|
if (isChrome) {
|
||||||
await ffmpeg.load({
|
await ffmpeg.load({
|
||||||
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
||||||
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm"),
|
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm"),
|
||||||
// workerURL: await toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, "text/javascript"),
|
// workerURL: await toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, "text/javascript"),
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
await ffmpeg.load({
|
||||||
|
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
||||||
|
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm"),
|
||||||
|
workerURL: await toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, "text/javascript"),
|
||||||
|
});
|
||||||
|
}
|
||||||
console.log(ffmpeg);
|
console.log(ffmpeg);
|
||||||
ffmpegLoaded = true;
|
ffmpegLoaded = true;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +212,12 @@
|
||||||
<div class="filter-picker">
|
<div class="filter-picker">
|
||||||
<FilterPicker select={"video"} />
|
<FilterPicker select={"video"} />
|
||||||
</div>
|
</div>
|
||||||
<div class="filters-holder" use:dndzone={{items:$filters}} on:consider={handleFilterSort} on:finalize={handleFilterSort}>
|
<div
|
||||||
|
class="filters-holder"
|
||||||
|
use:dndzone={{ items: $filters }}
|
||||||
|
on:consider={handleFilterSort}
|
||||||
|
on:finalize={handleFilterSort}
|
||||||
|
>
|
||||||
{#each $filters as f (f.id)}
|
{#each $filters as f (f.id)}
|
||||||
<div class="filter">
|
<div class="filter">
|
||||||
<Filter bind:filter={f} />
|
<Filter bind:filter={f} />
|
||||||
|
|
Loading…
Reference in New Issue