It's a known problem with Chrome, hopefully it'll get fixed soon.
Is currentTime supposed to start on audioContext creation or on creation of node graph objects?
-
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
}
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);
}
So I figure that either....
The initialization of the audioContext really means the first instance of creating something in the node graph.
Chrome ( which is the browser I'm using ) implemented it different than the spec
I'm missing something
Thank you.
Решение
Не связан с StackOverflow