Skip to content

Commit 7b49739

Browse files
author
terrill
committed
Fix new bug introduced with Vimeo commit
1 parent 7931ba7 commit 7b49739

4 files changed

Lines changed: 103 additions & 97 deletions

File tree

‎build/ableplayer.dist.js‎

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,38 +1295,40 @@ var AblePlayerInstances = [];
12951295
// sync all other tracks to this same languge
12961296
this.syncTrackLanguages('init',this.captionLang);
12971297
}
1298-
if (this.usingVimeoCaptions && this.prefCaptions == 1) {
1299-
// initialize Vimeo captions to the default language
1300-
this.vimeoPlayer.enableTextTrack(this.captionLang).then(function(track) {
1301-
// track.language = the iso code for the language
1302-
// track.kind = 'captions' or 'subtitles'
1303-
// track.label = the human-readable label
1304-
}).catch(function(error) {
1305-
switch (error.name) {
1306-
case 'InvalidTrackLanguageError':
1307-
// no track was available with the specified language
1308-
1309-
break;
1310-
case 'InvalidTrackError':
1311-
// no track was available with the specified language and kind
1312-
1313-
break;
1314-
default:
1315-
// some other error occurred
1316-
1317-
break;
1318-
}
1319-
});
1320-
}
1321-
else {
1322-
// disable Vimeo captions.
1323-
// captions are either provided locally, or user has them turned off.
1324-
this.vimeoPlayer.disableTextTrack().then(function() {
1325-
// Vimeo captions disabled
1326-
}).catch(function(error) {
1327-
1328-
});
1329-
}
1298+
if (this.usingVimeoCaptions) {
1299+
if (this.prefCaptions == 1) {
1300+
// initialize Vimeo captions to the default language
1301+
this.vimeoPlayer.enableTextTrack(this.captionLang).then(function(track) {
1302+
// track.language = the iso code for the language
1303+
// track.kind = 'captions' or 'subtitles'
1304+
// track.label = the human-readable label
1305+
}).catch(function(error) {
1306+
switch (error.name) {
1307+
case 'InvalidTrackLanguageError':
1308+
// no track was available with the specified language
1309+
1310+
break;
1311+
case 'InvalidTrackError':
1312+
// no track was available with the specified language and kind
1313+
1314+
break;
1315+
default:
1316+
// some other error occurred
1317+
1318+
break;
1319+
}
1320+
});
1321+
}
1322+
else {
1323+
// disable Vimeo captions.
1324+
// user has them turned off.
1325+
this.vimeoPlayer.disableTextTrack().then(function() {
1326+
// Vimeo captions disabled
1327+
}).catch(function(error) {
1328+
1329+
});
1330+
}
1331+
}
13301332
}
13311333
};
13321334

‎build/ableplayer.js‎

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,38 +1295,40 @@ var AblePlayerInstances = [];
12951295
// sync all other tracks to this same languge
12961296
this.syncTrackLanguages('init',this.captionLang);
12971297
}
1298-
if (this.usingVimeoCaptions && this.prefCaptions == 1) {
1299-
// initialize Vimeo captions to the default language
1300-
this.vimeoPlayer.enableTextTrack(this.captionLang).then(function(track) {
1301-
// track.language = the iso code for the language
1302-
// track.kind = 'captions' or 'subtitles'
1303-
// track.label = the human-readable label
1304-
}).catch(function(error) {
1305-
switch (error.name) {
1306-
case 'InvalidTrackLanguageError':
1307-
// no track was available with the specified language
1308-
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
1309-
break;
1310-
case 'InvalidTrackError':
1311-
// no track was available with the specified language and kind
1312-
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
1313-
break;
1314-
default:
1315-
// some other error occurred
1316-
console.log('Error loading ' + track.label + ' ' + track.kind + ' track');
1317-
break;
1318-
}
1319-
});
1320-
}
1321-
else {
1322-
// disable Vimeo captions.
1323-
// captions are either provided locally, or user has them turned off.
1324-
this.vimeoPlayer.disableTextTrack().then(function() {
1325-
// Vimeo captions disabled
1326-
}).catch(function(error) {
1327-
console.log('Error disabling Vimeo text track: ',error);
1328-
});
1329-
}
1298+
if (this.usingVimeoCaptions) {
1299+
if (this.prefCaptions == 1) {
1300+
// initialize Vimeo captions to the default language
1301+
this.vimeoPlayer.enableTextTrack(this.captionLang).then(function(track) {
1302+
// track.language = the iso code for the language
1303+
// track.kind = 'captions' or 'subtitles'
1304+
// track.label = the human-readable label
1305+
}).catch(function(error) {
1306+
switch (error.name) {
1307+
case 'InvalidTrackLanguageError':
1308+
// no track was available with the specified language
1309+
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
1310+
break;
1311+
case 'InvalidTrackError':
1312+
// no track was available with the specified language and kind
1313+
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
1314+
break;
1315+
default:
1316+
// some other error occurred
1317+
console.log('Error loading ' + track.label + ' ' + track.kind + ' track');
1318+
break;
1319+
}
1320+
});
1321+
}
1322+
else {
1323+
// disable Vimeo captions.
1324+
// user has them turned off.
1325+
this.vimeoPlayer.disableTextTrack().then(function() {
1326+
// Vimeo captions disabled
1327+
}).catch(function(error) {
1328+
console.log('Error disabling Vimeo text track: ',error);
1329+
});
1330+
}
1331+
}
13301332
}
13311333
};
13321334

‎build/ableplayer.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/initialize.js‎

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -741,38 +741,40 @@
741741
// sync all other tracks to this same languge
742742
this.syncTrackLanguages('init',this.captionLang);
743743
}
744-
if (this.usingVimeoCaptions && this.prefCaptions == 1) {
745-
// initialize Vimeo captions to the default language
746-
this.vimeoPlayer.enableTextTrack(this.captionLang).then(function(track) {
747-
// track.language = the iso code for the language
748-
// track.kind = 'captions' or 'subtitles'
749-
// track.label = the human-readable label
750-
}).catch(function(error) {
751-
switch (error.name) {
752-
case 'InvalidTrackLanguageError':
753-
// no track was available with the specified language
754-
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
755-
break;
756-
case 'InvalidTrackError':
757-
// no track was available with the specified language and kind
758-
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
759-
break;
760-
default:
761-
// some other error occurred
762-
console.log('Error loading ' + track.label + ' ' + track.kind + ' track');
763-
break;
764-
}
765-
});
766-
}
767-
else {
768-
// disable Vimeo captions.
769-
// captions are either provided locally, or user has them turned off.
770-
this.vimeoPlayer.disableTextTrack().then(function() {
771-
// Vimeo captions disabled
772-
}).catch(function(error) {
773-
console.log('Error disabling Vimeo text track: ',error);
774-
});
775-
}
744+
if (this.usingVimeoCaptions) {
745+
if (this.prefCaptions == 1) {
746+
// initialize Vimeo captions to the default language
747+
this.vimeoPlayer.enableTextTrack(this.captionLang).then(function(track) {
748+
// track.language = the iso code for the language
749+
// track.kind = 'captions' or 'subtitles'
750+
// track.label = the human-readable label
751+
}).catch(function(error) {
752+
switch (error.name) {
753+
case 'InvalidTrackLanguageError':
754+
// no track was available with the specified language
755+
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
756+
break;
757+
case 'InvalidTrackError':
758+
// no track was available with the specified language and kind
759+
console.log('No ' + track.kind + ' track is available in the specified language (' + track.label + ')');
760+
break;
761+
default:
762+
// some other error occurred
763+
console.log('Error loading ' + track.label + ' ' + track.kind + ' track');
764+
break;
765+
}
766+
});
767+
}
768+
else {
769+
// disable Vimeo captions.
770+
// user has them turned off.
771+
this.vimeoPlayer.disableTextTrack().then(function() {
772+
// Vimeo captions disabled
773+
}).catch(function(error) {
774+
console.log('Error disabling Vimeo text track: ',error);
775+
});
776+
}
777+
}
776778
}
777779
};
778780

0 commit comments

Comments
 (0)