Formatting
This commit is contained in:
parent
b694e7d3ab
commit
e147f3a754
@ -124,7 +124,9 @@ const captions = {
|
|||||||
|
|
||||||
// Handle tracks (add event listener and "pseudo"-default)
|
// Handle tracks (add event listener and "pseudo"-default)
|
||||||
if (this.isHTML5 && this.isVideo) {
|
if (this.isHTML5 && this.isVideo) {
|
||||||
tracks.filter(track => !meta.get(track)).forEach(track => {
|
tracks
|
||||||
|
.filter(track => !meta.get(track))
|
||||||
|
.forEach(track => {
|
||||||
this.debug.log('Track added', track);
|
this.debug.log('Track added', track);
|
||||||
// Attempt to store if the original dom element was "default"
|
// Attempt to store if the original dom element was "default"
|
||||||
meta.set(track, {
|
meta.set(track, {
|
||||||
@ -300,10 +302,12 @@ const captions = {
|
|||||||
const sortIsDefault = track => Number((this.captions.meta.get(track) || {}).default);
|
const sortIsDefault = track => Number((this.captions.meta.get(track) || {}).default);
|
||||||
const sorted = Array.from(tracks).sort((a, b) => sortIsDefault(b) - sortIsDefault(a));
|
const sorted = Array.from(tracks).sort((a, b) => sortIsDefault(b) - sortIsDefault(a));
|
||||||
let track;
|
let track;
|
||||||
|
|
||||||
languages.every(language => {
|
languages.every(language => {
|
||||||
track = sorted.find(track => track.language === language);
|
track = sorted.find(track => track.language === language);
|
||||||
return !track; // Break iteration if there is a match
|
return !track; // Break iteration if there is a match
|
||||||
});
|
});
|
||||||
|
|
||||||
// If no match is found but is required, get first
|
// If no match is found but is required, get first
|
||||||
return track || (force ? sorted[0] : undefined);
|
return track || (force ? sorted[0] : undefined);
|
||||||
},
|
},
|
||||||
@ -360,6 +364,7 @@ const captions = {
|
|||||||
// Get cues from track
|
// Get cues from track
|
||||||
if (!cues) {
|
if (!cues) {
|
||||||
const track = captions.getCurrentTrack.call(this);
|
const track = captions.getCurrentTrack.call(this);
|
||||||
|
|
||||||
cues = Array.from((track || {}).activeCues || [])
|
cues = Array.from((track || {}).activeCues || [])
|
||||||
.map(cue => cue.getCueAsHTML())
|
.map(cue => cue.getCueAsHTML())
|
||||||
.map(getHTML);
|
.map(getHTML);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user