HTML <트랙> 태그


예시

두 가지 언어에 대한 자막 트랙이 있는 비디오:

<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>

정의 및 사용

태그 는 <audio> 또는 <video> 요소 <track>에 대한 텍스트 트랙을 지정합니다 .

이 요소는 미디어가 재생될 때 표시되어야 하는 자막, 캡션 파일 또는 텍스트가 포함된 기타 파일을 지정하는 데 사용됩니다.

트랙은 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>태그는 HTML의 전역 속성도 지원 합니다 .


이벤트 속성

<track>태그는 HTML의 이벤트 속성 도 지원합니다 .


관련 페이지

HTML 튜토리얼: HTML 비디오

HTML 튜토리얼: HTML 오디오

HTML DOM 참조: 개체 추적


기본 CSS 설정

없음.