Flask and Wavesurfer.js audio playback not rendering on HTML

38 views Asked by At

I'm using flask on Python3.7 and trying to add playback functionality. My audio.HTML is rendering fine. However when I try to use the WaveSurfer.js package I get nothing. Do I have an issue in instantiating the wavesurfer instance?

I'm using the dpkg URL via: <script src="https://unpkg.com/wavesurfer.js@7"></script>

I have a 'div' for the content to load: <div id="waveform"> wavesurfer goes here </div>

I think that the below code is where my breakdown is happening. My URL is valid as I've been able to load get playback e.g. HTMLAudio. I was hoping to get some advice one way or another, whether I'm missing something, or on a fool's errand.

{% block scripts %} 
<script>  
var wavesurfer = WaveSurfer.create({
container: document.getElementById('waveform');
waveColor: '#4F4A85';
progressColor: '#383351';
url: "{{ url_for('static', filename=wavdir) }}";
sampleRate: 8789;
});

wavesurfer.on('click', () => {
  wavesurfer.play()
});
</script>
{% endblock %}
0

There are 0 answers