Supports for multiple caption tracks (VTT).
Name | subtitle |
Path | vlitejs/plugins/subtitle |
Entry point | vlitejs/plugins/subtitle/subtitle.js |
Stylesheet | vlitejs/plugins/subtitle/subtitle.css |
Provider² | 'html5' |
Media type³ | 'video' |
<video id="player" src="<path_to_video_mp4>">
<track label="English" kind="subtitles" srclang="en" src="<path_to_subtitle_en.vtt>" default />
<track label="French" kind="subtitles" srclang="fr" src="<path_to_subtitle_fr.vtt>" />
</video>
import 'vlitejs/vlite.css';
import 'vlitejs/plugins/subtitle.css';
import Vlitejs from 'vlitejs';
import VlitejsSubtitle from 'vlitejs/plugins/subtitle.js';
Vlitejs.registerPlugin('subtitle', VlitejsSubtitle);
new Vlitejs('#player', {
plugins: ['subtitle']
});
The plugin exposes the following native Event
on the .v-vlite
element.
Event Type | Description |
---|---|
trackenabled |
Sent when a track is enabled and displayed |
trackdisabled |
Sent when a track is disabled and hidden |
See the Subtitle plugin demo.