AudioContext.currentTime
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
The currentTime
read-only property of the AudioContext
interface returns a double representing an ever-increasing hardware timestamp in seconds that can be used for scheduling audio playback, visualizing timelines, etc. It starts at 0.
Syntax
js
var audioCtx = new AudioContext();
console.log(audioCtx.currentTime);
Exemplo
js
var AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
// Older webkit/blink browsers require a prefix
...
console.log(audioCtx.currentTime);
Especificações
Specification |
---|
Web Audio API # dom-baseaudiocontext-currenttime |
Compatibilidade com navegadores
BCD tables only load in the browser