Skip to content

Latest commit

 

History

History
 
 

subtitle

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Plugin: Subtitle

Supports for multiple caption tracks (VTT).

Overview

Name subtitle
Global name¹ window.VlitejsSubtitle
Path vlitejs/dist/plugins/subtitle
Entry point vlitejs/dist/plugins/subtitle/subtitle.js
Stylesheet vlitejs/dist/plugins/subtitle/subtitle.css
Provider² 'html5'
Media type³ 'video'
  • ¹ Useful only if vLitejs is included with a <script> tag (see CDN section).

Usage

HTML

<video id="player" class="vlite-js" 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>

JavaScript

import 'vlitejs/dist/vlite.css';
import 'vlitejs/dist/plugins/subtitle.css';
import Vlitejs from 'vlitejs';
import VlitejsSubtitle from 'vlitejs/dist/plugins/subtitle';

Vlitejs.registerPlugin('subtitle', VlitejsSubtitle);

new Vlitejs('#player', {
  plugins: ['subtitle']
});

Events

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

Demo

See the Subtitle plugin demo.