fix: confirm before generating audio peaks in browser, avoid lock-ups in Chrome
parent
a6c07c7810
commit
40381cf46d
|
@ -208,10 +208,21 @@
|
|||
const peaks = await peaksReq.json();
|
||||
wavesurfer.load(`${API_URL}/raw/${address}`, peaks.data);
|
||||
} catch (e) {
|
||||
console.warn(
|
||||
`Failed to load peaks from server (${e}), falling back to client-side render...`
|
||||
);
|
||||
wavesurfer.load(`${API_URL}/raw/${address}`);
|
||||
console.warn(`Failed to load peaks: ${e}`);
|
||||
const entity = await fetchEntity(address);
|
||||
console.log(entity.get("FILE_SIZE"));
|
||||
if (
|
||||
(entity.get("FILE_SIZE") || 0) < 20_000_000 ||
|
||||
confirm(
|
||||
"File is large (>20 MiB) and UpEnd failed to load waveform from server. Generating the waveform locally may slow down your browser. Do you wish to proceed anyway?"
|
||||
)
|
||||
) {
|
||||
console.warn(
|
||||
`Failed to load peaks, falling back to client-side render...`
|
||||
);
|
||||
|
||||
wavesurfer.load(`${API_URL}/raw/${address}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue