You are not logged in.

#1 2014-11-21 04:17:20

laertiades
Member
From: Seattle
Registered: 2013-01-20
Posts: 11
Website

web audio api is disabled with Firefox after resume from sleep

I have encountered what appears to be a bug with Firefox's implementation of the Web Audio API.  The following jsfiddle illustrates the problem:

    var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
    var source;
    function getData() {
      source = audioCtx.createBufferSource();
      request = new XMLHttpRequest();
      request.open('GET', 'https://s3-us-west-2.amazonaws.com/mpclubtest/tracks/waves/000/000/155/mp3/Chasing_after_you.mp3', true);
      request.responseType = 'arraybuffer';
      request.onload = function() {
        var audioData = request.response;
        audioCtx.decodeAudioData(audioData, function(buffer) {
            source.buffer = buffer;
            source.connect(audioCtx.destination);
          },
          function(e){"Error with decoding audio data" + e.err});
      }
      request.send();
    }
    getData();
    source.start(0);

When running this code with Firefox (3.17.3-1-ARCH) if I put the computer to sleep, when it resumes the script no longer works.  I have reproduced the problem on two computers running Arch.  Refreshing the page doesn't even help.  Closing and reopening the browser fixes it.  Also playing a video with youtube in a different tab gets it working again.  Can anyone shed some light?  I would be interested to know what exactly is going wrong and how best to handle the problem.  Thanks for any help.


"Conversation enriches the understanding, but solitude is the school of genius"

Offline

Board footer

Powered by FluxBB