Play    Play   

首頁  >  文章  >  web前端  >  當媒體暫停但預計在HTML中恢復時執行腳本

當媒體暫停但預計在HTML中恢復時執行腳本

王林
王林轉載
2023-09-07 21:33:02983瀏覽

當媒體暫停但預計在HTML中恢復時執行腳本

等待 屬性在視訊暫停並緩衝以再次恢復時觸發。您可以嘗試執行以下程式碼來實作onwaiting 屬性 -

#範例

<!DOCTYPE html>
<html>
   <body>
      <h2 id = "test">Play</h2>
      <video id = "myid" width = "320" height = "176" controls onwaiting = "myFunction()">
         <source src = "/html5/foo.ogg" type = "video/ogg" />
         <source src = "/html5/foo.mp4" type = "video/mp4" />
         Your browser does not support the video element.
      </video>
      <script>
         function myFunction() {
            document.getElementById("test").innerHTML = "Media resumes again";
         }
      </script>
   </body>
</html>

以上是當媒體暫停但預計在HTML中恢復時執行腳本的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除