如何識別當用戶的偏好沒有表明另一條音軌更合適時音軌要在 HTML 中啟用?
如果您為影片提供兩個字幕音軌,則使用 default 屬性可以識別要啟用的音軌。
例項
您可以嘗試以下程式碼來為音軌實現預設屬性 −
<!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>
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
安卓
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP