This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

currentTime

Summary

This is a time in seconds which starts at zero when the context is created and increases in real-time. All scheduled times are relative to it. This is not a transport time which can be started, paused, and re-positioned. It is always moving forward. A GarageBand-like timeline transport system can be very easily built on top of this (in JavaScript). This time corresponds to an ever-increasing hardware timestamp.

Property of apis/webaudio/AudioContextapis/webaudio/AudioContext

Syntax

Note: This property is read-only.

var result = AudioContext.currentTime;

Return Value

Returns an object of type NumberNumber

Examples

var audioCtx = new AudioContext();
var ct = audioCtx.currentTime;

Related specifications

W3C Web Audio API
W3C Editor’s Draft