use multi-threading if not chrome
This commit is contained in:
parent
99b4143dd6
commit
5d0663eb12
|
@ -7,9 +7,10 @@
|
|||
import FilterPicker from "./FilterPicker.svelte";
|
||||
import { FFmpeg } from "@ffmpeg/ffmpeg";
|
||||
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 TIMEOUT = 40000;
|
||||
|
||||
|
@ -62,11 +63,19 @@
|
|||
logbox.scrollTop = logbox.scrollHeight;
|
||||
// message = msg;
|
||||
});
|
||||
if (isChrome) {
|
||||
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"),
|
||||
});
|
||||
} 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);
|
||||
ffmpegLoaded = true;
|
||||
}
|
||||
|
@ -203,7 +212,12 @@
|
|||
<div class="filter-picker">
|
||||
<FilterPicker select={"video"} />
|
||||
</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)}
|
||||
<div class="filter">
|
||||
<Filter bind:filter={f} />
|
||||
|
|
Loading…
Reference in New Issue