当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


HTML AudioContext baseLatency用法及代码示例


先决条件:AudioContext outputLatency属性

AudioContext接口中的baseLatency只读属性用于表示AudioContext从AudioDestinationNode传递音频缓冲区所引起的处理延迟的秒数

用法:

var Latency = audioCtx.baseLatency;

返回值:

A double value is returned in seconds.

范例1:



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

输出:

范例2:

<!DOCTYPE html>  
<html>  
<head>  
    <title>  
        AudioContext baseLatency property  
    </title>  
</head>  
    
<body style="text-align:center;"> 
    <center>  
        <h1 style="color:green">  
        GeeksforGeeks  
        </h1>  
        <h2>AudioContext baseLatency property</h2>  
        <script>  
        const laten2 = new AudioContext({ latencyHint:'playback' }); 
        console.log(laten2.baseLatency); 
        </script>  
    </center>  
</body>  
    
</html> 

输出:

支持的浏览器:下面列出了HTML AudioContext baseLatency属性支持的浏览器:

  • 谷歌浏览器
  • Edge
  • Firefox
  • Opera




相关用法


注:本文由纯净天空筛选整理自SHUBHAMSINGH10大神的英文原创作品 HTML | AudioContext baseLatency property。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。