wavesurfer.js: Chrome: Failed to set the 'buffer' property on 'AudioBufferSourceNode'

Everything works fine on Firefox and I had this working on Chrome a while back. However, now no wave form appears, the “ready” event never gets fired, and when I click play this error occurs:

Uncaught TypeError: Failed to set the ‘buffer’ property on ‘AudioBufferSourceNode’: The provided value is not of type ‘AudioBuffer’.

The file is .wav

Right now I’m basically calling this behemoth of a function, with the url being the url of the audio file and waveform being equal to Object.create(WaveSurfer):

  init: function(waveform, url){
    var waveHeight = ($("#middle-column").outerHeight() - $("#header").outerHeight() - 150);
    waveform.init({
      container     : document.querySelector('#wave'),
      waveColor     : 'grey',
      progressColor : 'darkcyan',
      loaderColor   : 'purple',
      cursorColor   : 'navy',
      markerWidth   : 2,
      dragSelection : false,
      pixelRatio    : 5,
      minPxPerSec   : 15,
      fillParent    : true,
      height        : waveHeight
    });
    waveform.load(url);
    waveform.on('ready', function () {
      $("#timer-current").html("0.00 s");
      $("#timer-end").html(waveform.getDuration().toFixed(2) + ' s');
    });
    waveform.on('finish', function () {
      $("#pause-recording").click();
      $("#timer-current").html("0.00 s");
       waveform.stop();
    });
    $("#start-recording").click(function(){
      waveform.play();
    });
    waveform.on('progress', function () {
      var currentTime = waveform.getCurrentTime().toFixed(2);
      var remainingTime = (waveform.getDuration() - currentTime).toFixed(2);
      $("#timer-end").html(remainingTime + ' s');
      $("#timer-current").html(currentTime + ' s');
    });
    $("#pause-recording").click(function(){
      waveform.pause();
    });
  }

Seems this is a known regression with Chrome: https://code.google.com/p/chromium/issues/detail?id=128826 http://stackoverflow.com/questions/14825030/uncaught-typeerror-value-is-not-of-type-audiobuffer

Still don’t quite know easiest way to fix it…

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

The chromium core support sample rates from 3 kHz to 192 kHz