如何在 HTML 中指定文字軌道的型別?


使用 HTML 中的 kind 屬性來指定 HTML 中文字軌道的型別。例如,可以將 subtitle 檔案的型別設定為 subtitle。

示例

可以嘗試執行以下程式碼來實現 kind 屬性 -

<!DOCTYPE HTML>
<html>
   <body>

      <video width = "300" height="200" controls autoplay>
         <source src = "/html5/foo.ogg" type = "video/ogg" />
         <source src = "/html5/foo.mp4" type = "video/mp4" />
         <track src = "subtitles_en.vtt" kind = "subtitles" srclang = "en" label = "English">
         <track src = "subtitles_ru.vtt" kind = "subtitles" srclang = "ru" label = "Russia" default>
         Your browser does not support the video element.
      </video>

   </body>
</html>

更新日期:2020 年 3 月 3 日

97 檢視

啟動你的職業生涯

完成課程獲得認證

開始
廣告
© . All rights reserved.