Skip to content

Commit 4646809

Browse files
committed
Fix bug in handling default attribute on caption or subtitle tracks
1 parent 4b55e4b commit 4646809

6 files changed

Lines changed: 15 additions & 12 deletions

File tree

build/ableplayer.dist.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,7 +5554,7 @@ var AblePlayerInstances = [];
55545554
};
55555555

55565556
AblePlayer.prototype.getTracks = function () {
5557-
5557+
55585558
// define an array tracks with the following structure:
55595559
// kind - string, e.g. "captions", "descriptions"
55605560
// src - string, URL of WebVTT source file
@@ -5601,7 +5601,7 @@ var AblePlayerInstances = [];
56015601
trackLabel = thisObj.getLanguageName(trackLang);
56025602
}
56035603

5604-
if (typeof $(this).attr('default') !== 'undefined' && !hasDefault) {
5604+
if (typeof $(this).attr('default') !== 'undefined' && !hasDefault) {
56055605
isDefault = true;
56065606
hasDefault = true;
56075607
}
@@ -5611,6 +5611,7 @@ var AblePlayerInstances = [];
56115611
// if there is no other default track specified
56125612
// this will be the default
56135613
hasTrackInDefLang = true;
5614+
isDefault = false; // for now; this could change if there's no default attribute
56145615
}
56155616
else {
56165617
isDefault = false;
@@ -10305,7 +10306,7 @@ var AblePlayerInstances = [];
1030510306
};
1030610307

1030710308
AblePlayer.prototype.updateCaptionsMenu = function (lang) {
10308-
10309+
1030910310
// uncheck all previous menu items
1031010311
this.captionsPopup.find('li').attr('aria-checked','false');
1031110312
if (typeof lang === 'undefined') {

build/ableplayer.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,7 +5554,7 @@ var AblePlayerInstances = [];
55545554
};
55555555

55565556
AblePlayer.prototype.getTracks = function () {
5557-
5557+
55585558
// define an array tracks with the following structure:
55595559
// kind - string, e.g. "captions", "descriptions"
55605560
// src - string, URL of WebVTT source file
@@ -5601,7 +5601,7 @@ var AblePlayerInstances = [];
56015601
trackLabel = thisObj.getLanguageName(trackLang);
56025602
}
56035603

5604-
if (typeof $(this).attr('default') !== 'undefined' && !hasDefault) {
5604+
if (typeof $(this).attr('default') !== 'undefined' && !hasDefault) {
56055605
isDefault = true;
56065606
hasDefault = true;
56075607
}
@@ -5611,6 +5611,7 @@ var AblePlayerInstances = [];
56115611
// if there is no other default track specified
56125612
// this will be the default
56135613
hasTrackInDefLang = true;
5614+
isDefault = false; // for now; this could change if there's no default attribute
56145615
}
56155616
else {
56165617
isDefault = false;
@@ -10305,7 +10306,7 @@ var AblePlayerInstances = [];
1030510306
};
1030610307

1030710308
AblePlayer.prototype.updateCaptionsMenu = function (lang) {
10308-
10309+
1030910310
// uncheck all previous menu items
1031010311
this.captionsPopup.find('li').attr('aria-checked','false');
1031110312
if (typeof lang === 'undefined') {

build/ableplayer.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ableplayer",
3-
"version": "4.4.49",
3+
"version": "4.4.50",
44
"description": "Accessible HTML5 media player",
55
"homepage": "http://ableplayer.github.io/ableplayer",
66
"bugs": "https://github.com/ableplayer/ableplayer/issues",

scripts/caption.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
};
1818

1919
AblePlayer.prototype.updateCaptionsMenu = function (lang) {
20-
20+
2121
// uncheck all previous menu items
2222
this.captionsPopup.find('li').attr('aria-checked','false');
2323
if (typeof lang === 'undefined') {

scripts/track.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
};
106106

107107
AblePlayer.prototype.getTracks = function () {
108-
108+
109109
// define an array tracks with the following structure:
110110
// kind - string, e.g. "captions", "descriptions"
111111
// src - string, URL of WebVTT source file
@@ -152,7 +152,7 @@
152152
trackLabel = thisObj.getLanguageName(trackLang);
153153
}
154154

155-
if (typeof $(this).attr('default') !== 'undefined' && !hasDefault) {
155+
if (typeof $(this).attr('default') !== 'undefined' && !hasDefault) {
156156
isDefault = true;
157157
hasDefault = true;
158158
}
@@ -162,6 +162,7 @@
162162
// if there is no other default track specified
163163
// this will be the default
164164
hasTrackInDefLang = true;
165+
isDefault = false; // for now; this could change if there's no default attribute
165166
}
166167
else {
167168
isDefault = false;

0 commit comments

Comments
 (0)