Set a background on wavesurfer and clear it.

Hopefully fixes ghost waveforms and scroll bars
This commit is contained in:
Matthew Stratford 2020-05-20 20:23:14 +01:00
parent 0e56146ad7
commit 78c6b80915
2 changed files with 9 additions and 0 deletions

View file

@ -97,6 +97,7 @@ class Player extends ((PlayerEmitter as unknown) as { new (): EventEmitter }) {
audioContext: engine.audioContext,
container: "#waveform-" + player.toString(),
waveColor: "#CCCCFF",
backgroundColor: "#FFFFFF",
progressColor: "#9999FF",
backend: "MediaElementWebAudio",
barWidth: 2,

View file

@ -294,6 +294,14 @@ export const load = (
console.log("loading");
let waveform = document.getElementById("waveform-" + player.toString());
if (waveform == null) {
throw new Error();
}
waveform.innerHTML = ""; // clear previous (ghost) wavesurfer
// wavesurfer also sets the background white, remove for progress bar to work.
waveform.style.removeProperty("background");
try {
const signal = loadAbortControllers[player].signal; // hang on to the signal, even if its controller gets replaced
const result = await fetch(url, {