Make conversion cancelable

This commit is contained in:
Vanilagy
2025-02-09 17:55:59 +01:00
parent 02ac371011
commit b3cd4de1f6
3 changed files with 68 additions and 1 deletions
+8 -1
View File
@@ -18,6 +18,12 @@
const target = new Metamuxer.BufferTarget();
const outputFormat = new Metamuxer.Mp4OutputFormat()
const abortController = new AbortController();
const button = document.createElement('button');
button.textContent = 'Cancel';
button.onclick = () => abortController.abort();
document.body.append(button);
console.time()
const res = await Metamuxer.convert({
input: new Metamuxer.Input({
@@ -61,7 +67,8 @@
},
onProgress: (event) => {
progress.value = event.completion;
}
},
abortSignal: abortController.signal
});
console.timeEnd()
console.log(res)