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.

io error: No such file or directory (os error 2) (/home/runner/work/yari/yari/mdn/translated-content/files/pt-br/web/api/baseaudiocontext/index.md)

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

Veja também