當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。