new Player()
This class extends the video.js Player.
- Source
Methods
audioTrack(trackSelectoropt) → {module:video.js/dist/types/tracks/audio-track~default|undefined}
A getter/setter for the media's audio track. Activates the audio track according to the language and kind properties. Falls back on the first audio track found if the kind property is not satisfied.
Name | Type | Attributes | Description |
---|---|---|---|
trackSelector | TrackSelector | <optional> |
- Source
The currently enabled audio track. See https://docs.videojs.com/audiotrack.
- Type:
- module:video.
js/dist/types/tracks/audio-track~default |undefined
// Get the current audio track
player.audioTrack();
// Activate an audio track based on language and kind properties
player.audioTrack({language:'en', kind:'description'});
// Activate first audio track found corresponding to language
player.audioTrack({language:'fr'});
bufferedRanges() → {Array.<{start: number, end: number}>}
Calculates an array of ranges based on the buffered()
data.
- Source
An array of objects representing start and end points of buffered ranges.
- Type:
- Array.<{start: number, end: number}>
playedPercent() → {number}
Get the percent (as a decimal) of the media that's been played. This method is not a part of the native HTML video API.
Live streams with DVR are not currently supported.
- Source
A decimal between 0 and 1 representing the percent that is played 0 being 0% and 1 being 100%
- Type:
- number
playedRanges() → {Array.<{start: number, end: number}>}
Get an array of ranges based on the played
data.
- Source
An array of objects representing start and end points of played ranges.
- Type:
- Array.<{start: number, end: number}>
seekableRanges() → {Array.<{start: number, end: number}>}
Calculates an array of ranges based on the seekable()
data.
- Source
An array of objects representing start and end points of seekable ranges.
- Type:
- Array.<{start: number, end: number}>
textTrack(trackSelectoropt) → {module:video.js/dist/types/tracks/text-track~default|undefined}
A getter/setter for the media's text track. Activates the text track according to the language and kind properties. Falls back on the first text track found if the kind property is not satisfied. Disables all subtitle tracks that are showing
if the trackSelector
is truthy but does not satisfy any condition.
Name | Type | Attributes | Description |
---|---|---|---|
trackSelector | TrackSelector | <optional> |
- Source
The currently enabled text track. See https://docs.videojs.com/texttrack.
- Type:
- module:video.
js/dist/types/tracks/text-track~default |undefined
// Get the current text track
player.textTrack();
// Disable all text tracks has a side effect
player.textTrack('off');
player.textTrack({});
// Activate an text track based on language and kind properties
player.textTrack({language:'en', kind:'captions'});
// Activate first text track found corresponding to language
player.textTrack({language:'fr'});