Open In App

Web Audio API | AudioContext outputLatency property

The AudioContext interface has a outputLatency property which provides an approximation of the latency in output of the current audio context. This time is between the browser requesting to the host system to start a buffer and the time at which the first sample in the buffer is actually processed by the audio output device.

Syntax:



var latency = audioCtx.outputLatency;

Return Value:

A double value is returned in seconds

Example 1:




<!DOCTYPE html>
<html>
  
<head>
    <title>
        AudioContext outputLatency property
    </title>
</head>
  
<body>
    <center>
        <h1 style="color:green">
        GeeksforGeeks
        </h1>
        <h2>AudioContext outputLatency property</h2>
        <script>
            const audioCtx = new AudioContext();
            console.log(audioCtx.outputLatency);
        </script>
    </center>
</body>
  
</html>

Output:



undefined

Supported Browsers:

Article Tags :