var wavesurfer = WaveSurfer.create({ container: '#waveform', waveColor: 'violet', progressColor: 'purple' }); wavesurfer.on('ready', function () { wavesurfer.play(); }); let audio = document.getElementById('audio'); let file_path = audio.src; wavesurfer.load(file_path);