Esta página foi traduzida do inglês pela comunidade. Saiba mais e junte-se à comunidade MDN Web Docs.
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 abril de 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
Enable JavaScript to view this browser compatibility table.