HTML <track>แท็ก
ตัวอย่าง
วิดีโอพร้อมแทร็กคำบรรยายสำหรับสองภาษา:
<video width="320" height="240" controls>
<source src="forrest_gump.mp4" type="video/mp4">
<source src="forrest_gump.ogg" type="video/ogg">
<track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>
ความหมายและการใช้งาน
แท็ ก<track>
ระบุแทร็กข้อความสำหรับ
องค์ประกอบ<audio>หรือ<video>
องค์ประกอบนี้ใช้เพื่อระบุคำบรรยาย ไฟล์คำอธิบายภาพ หรือไฟล์อื่นๆ ที่มีข้อความ ซึ่งควรมองเห็นได้เมื่อสื่อกำลังเล่น
แทร็กจัดรูปแบบในรูปแบบ WebVTT (ไฟล์ .vtt)
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนองค์ประกอบอย่างสมบูรณ์
Element | |||||
---|---|---|---|---|---|
<track> | 23.0 | 10.0 | 31.0 | 6.0 | 12.1 |
คุณสมบัติเสริม
Attribute | Value | Description |
---|---|---|
default | default | Specifies that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate |
kind | captions chapters descriptions metadata subtitles |
Specifies the kind of text track |
label | text | Specifies the title of the text track |
src | URL | Required. Specifies the URL of the track file |
srclang | language_code | Specifies the language of the track text data (required if kind="subtitles") |
คุณสมบัติสากล
แท็ ก<track>
ยังสนับสนุน Global Attributes ในHTML
คุณสมบัติของเหตุการณ์
แท็ ก<track>
ยังสนับสนุนแอตทริบิวต์เหตุการณ์ใน HTML
หน้าที่เกี่ยวข้อง
กวดวิชา HTML: HTML วิดีโอ
กวดวิชา HTML: HTML Audio
การอ้างอิง HTML DOM: ติดตามวัตถุ
การตั้งค่า CSS เริ่มต้น
ไม่มี.