Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> HTML

Cách tạo tiêu đề cho text track trong HTML?

Sử dụng thuộc tính label trong HTML để tạo tiêu đề cho text track.

Ví dụ

Bạn có thể chạy mã sau để triển khai thuộc tính label:

<!DOCTYPE HTML>
<html>
  <body>
    <video width="450" height="300" 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>
      Trình duyệt của bạn không hỗ trợ phần tử video.
    </video>
  </body>
</html>