Is currentTime supposed to start on audioContext creation or on creation of node graph objects?

StackOverflow https://stackoverflow.com/questions/23578351

  •  19-07-2023
  •  | 
  •  

Вопрос

In the w3c specification this sentence exists:

currentTime

This is a time in seconds which starts at zero when the context is created and increases in real-time

Now when I create piece of code with just the audioContext initialized and run a setInterval to output audioContext.currentTime I get back nothing but 0's.

var audioContext = new webkitAudioContext();

setInterval(getTime,1000);

    function getTime() {

        console.log(audioContext.currentTime);   // 0
    }

http://jsfiddle.net/Ly6tQ/

However

If I add a node graph object the currentTime begins outputting.

   var audioContext = new webkitAudioContext();

    var osc = audioContext.createOscillator();


setInterval(getTime,1000);

    function getTime() {

        console.log(audioContext.currentTime);
    }

http://jsfiddle.net/Ly6tQ/1/

So I figure that either....

  1. The initialization of the audioContext really means the first instance of creating something in the node graph.

  2. Chrome ( which is the browser I'm using ) implemented it different than the spec

  3. I'm missing something

Thank you.

Это было полезно?

Решение

It's a known problem with Chrome, hopefully it'll get fixed soon.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top