wai-website-theme 1.3.1 → 1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/different.html +2 -1
- data/_includes/external.html +2 -1
- data/_includes/header.html +2 -1
- data/_includes/menuitem.html +6 -2
- data/_includes/peoplelist.html +21 -0
- data/_includes/prevnext-navigation.html +56 -0
- data/_includes/{prevnext.html → prevnext-order.html} +9 -0
- data/_includes/translation-note-msg.html +5 -3
- data/_includes/video-player.html +2 -2
- data/_layouts/default.html +8 -1
- data/_layouts/news.html +7 -1
- data/_layouts/policy.html +7 -1
- data/_layouts/sidenav.html +8 -1
- data/_layouts/sidenavsidebar.html +8 -1
- data/assets/ableplayer/Gruntfile.js +2 -1
- data/assets/ableplayer/README.md +158 -85
- data/assets/ableplayer/build/ableplayer.dist.js +15445 -13823
- data/assets/ableplayer/build/ableplayer.js +15445 -13823
- data/assets/ableplayer/build/ableplayer.min.css +1 -2
- data/assets/ableplayer/build/ableplayer.min.js +3 -10
- data/assets/ableplayer/package-lock.json +944 -346
- data/assets/ableplayer/package.json +8 -8
- data/assets/ableplayer/scripts/ableplayer-base.js +515 -524
- data/assets/ableplayer/scripts/browser.js +158 -158
- data/assets/ableplayer/scripts/buildplayer.js +1750 -1682
- data/assets/ableplayer/scripts/caption.js +424 -401
- data/assets/ableplayer/scripts/chapters.js +259 -259
- data/assets/ableplayer/scripts/control.js +1831 -1594
- data/assets/ableplayer/scripts/description.js +333 -256
- data/assets/ableplayer/scripts/dialog.js +145 -145
- data/assets/ableplayer/scripts/dragdrop.js +746 -749
- data/assets/ableplayer/scripts/event.js +875 -696
- data/assets/ableplayer/scripts/initialize.js +819 -912
- data/assets/ableplayer/scripts/langs.js +979 -743
- data/assets/ableplayer/scripts/metadata.js +124 -124
- data/assets/ableplayer/scripts/misc.js +170 -137
- data/assets/ableplayer/scripts/preference.js +904 -904
- data/assets/ableplayer/scripts/search.js +172 -172
- data/assets/ableplayer/scripts/sign.js +82 -78
- data/assets/ableplayer/scripts/slider.js +449 -448
- data/assets/ableplayer/scripts/track.js +409 -309
- data/assets/ableplayer/scripts/transcript.js +684 -595
- data/assets/ableplayer/scripts/translation.js +63 -67
- data/assets/ableplayer/scripts/ttml2webvtt.js +85 -85
- data/assets/ableplayer/scripts/vimeo.js +448 -0
- data/assets/ableplayer/scripts/volume.js +395 -380
- data/assets/ableplayer/scripts/vts.js +1077 -1077
- data/assets/ableplayer/scripts/webvtt.js +766 -763
- data/assets/ableplayer/scripts/youtube.js +695 -478
- data/assets/ableplayer/styles/ableplayer.css +54 -46
- data/assets/ableplayer/translations/nl.js +54 -54
- data/assets/ableplayer/translations/pt-br.js +311 -0
- data/assets/ableplayer/translations/tr.js +311 -0
- data/assets/ableplayer/translations/zh-tw.js +1 -1
- data/assets/css/style.css +1 -1
- data/assets/css/style.css.map +1 -1
- data/assets/images/icons.svg +5 -5
- data/assets/scripts/main.js +7 -0
- data/assets/search/tipuesearch.js +3 -3
- metadata +8 -3
|
@@ -1,312 +1,412 @@
|
|
|
1
1
|
(function ($) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
2
|
+
// Loads files referenced in track elements, and performs appropriate setup.
|
|
3
|
+
// For example, captions and text descriptions.
|
|
4
|
+
// This will be called whenever the player is recreated.
|
|
5
|
+
// Added in v2.2.23: Also handles YouTube caption tracks
|
|
6
|
+
|
|
7
|
+
AblePlayer.prototype.setupTracks = function() {
|
|
8
|
+
|
|
9
|
+
var thisObj, deferred, promise, loadingPromises, loadingPromise, i, tracks, track;
|
|
10
|
+
|
|
11
|
+
thisObj = this;
|
|
12
|
+
|
|
13
|
+
deferred = new $.Deferred();
|
|
14
|
+
promise = deferred.promise();
|
|
15
|
+
|
|
16
|
+
loadingPromises = [];
|
|
17
|
+
|
|
18
|
+
this.captions = [];
|
|
19
|
+
this.captionLabels = [];
|
|
20
|
+
this.descriptions = [];
|
|
21
|
+
this.chapters = [];
|
|
22
|
+
this.meta = [];
|
|
23
|
+
|
|
24
|
+
if ($('#able-vts').length) {
|
|
25
|
+
// Page includes a container for a VTS instance
|
|
26
|
+
this.vtsTracks = [];
|
|
27
|
+
this.hasVts = true;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.hasVts = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
this.getTracks().then(function() {
|
|
34
|
+
|
|
35
|
+
tracks = thisObj.tracks;
|
|
36
|
+
|
|
37
|
+
if (thisObj.player === 'youtube') {
|
|
38
|
+
// If captions have been loaded into the captions array (either from YouTube or a local source),
|
|
39
|
+
// we no longer have a need to use YouTube captions
|
|
40
|
+
// TODO: Consider whether this is the right place to make this decision
|
|
41
|
+
// Probably better to make it when cues are identified from YouTube caption sources
|
|
42
|
+
if (tracks.length) {
|
|
43
|
+
thisObj.usingYouTubeCaptions = false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
for (i=0; i < tracks.length; i++) {
|
|
48
|
+
|
|
49
|
+
track = tracks[i];
|
|
50
|
+
|
|
51
|
+
var kind = track.kind;
|
|
52
|
+
var trackLang = track.language;
|
|
53
|
+
var trackLabel = track.label;
|
|
54
|
+
|
|
55
|
+
if (!track.src) {
|
|
56
|
+
if (thisObj.usingYouTubeCaptions || thisObj.usingVimeoCaptions) {
|
|
57
|
+
// skip all the hullabaloo and go straight to setupCaptions
|
|
58
|
+
thisObj.setupCaptions(track,trackLang,trackLabel);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Nothing to load!
|
|
62
|
+
// Skip this track; move on to next i
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var trackSrc = track.src;
|
|
68
|
+
|
|
69
|
+
loadingPromise = thisObj.loadTextObject(trackSrc); // resolves with src, trackText
|
|
70
|
+
loadingPromises.push(loadingPromise);
|
|
71
|
+
|
|
72
|
+
loadingPromise.then((function (track, kind) {
|
|
73
|
+
|
|
74
|
+
var trackSrc = track.src;
|
|
75
|
+
var trackLang = track.language;
|
|
76
|
+
var trackLabel = track.label;
|
|
77
|
+
|
|
78
|
+
return function (trackSrc, trackText) { // these are the two vars returned from loadTextObject
|
|
79
|
+
|
|
80
|
+
var trackContents = trackText;
|
|
81
|
+
var cues = thisObj.parseWebVTT(trackSrc, trackContents).cues;
|
|
82
|
+
|
|
83
|
+
if (thisObj.hasVts) {
|
|
84
|
+
// setupVtsTracks() is in vts.js
|
|
85
|
+
thisObj.setupVtsTracks(kind, trackLang, trackLabel, trackSrc, trackContents);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (kind === 'captions' || kind === 'subtitles') {
|
|
89
|
+
thisObj.setupCaptions(track, trackLang, trackLabel, cues);
|
|
90
|
+
}
|
|
91
|
+
else if (kind === 'descriptions') {
|
|
92
|
+
thisObj.setupDescriptions(track, cues, trackLang);
|
|
93
|
+
}
|
|
94
|
+
else if (kind === 'chapters') {
|
|
95
|
+
thisObj.setupChapters(track, cues, trackLang);
|
|
96
|
+
}
|
|
97
|
+
else if (kind === 'metadata') {
|
|
98
|
+
thisObj.setupMetadata(track, cues);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
})(track, kind));
|
|
102
|
+
}
|
|
103
|
+
$.when.apply($, loadingPromises).then(function () {
|
|
104
|
+
deferred.resolve();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return promise;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
AblePlayer.prototype.getTracks = function() {
|
|
112
|
+
|
|
113
|
+
// define an array tracks with the following structure:
|
|
114
|
+
// kind - string, e.g. "captions", "descriptions"
|
|
115
|
+
// src - string, URL of WebVTT source file
|
|
116
|
+
// language - string, lang code
|
|
117
|
+
// label - string to display, e.g., in CC menu
|
|
118
|
+
// def - Boolean, true if this is the default track
|
|
119
|
+
// cues - array with startTime, endTime, and payload
|
|
120
|
+
|
|
121
|
+
var thisObj, deferred, promise, captionTracks, trackLang, trackLabel, isDefault;
|
|
122
|
+
|
|
123
|
+
thisObj = this;
|
|
124
|
+
|
|
125
|
+
deferred = new $.Deferred();
|
|
126
|
+
promise = deferred.promise();
|
|
127
|
+
|
|
128
|
+
this.$tracks = this.$media.find('track');
|
|
129
|
+
this.tracks = [];
|
|
130
|
+
|
|
131
|
+
if (this.$tracks.length) {
|
|
132
|
+
|
|
133
|
+
// create object from HTML5 tracks
|
|
134
|
+
this.$tracks.each(function() {
|
|
135
|
+
|
|
136
|
+
// srcLang should always be included with <track>, but HTML5 spec doesn't require it
|
|
137
|
+
// if not provided, assume track is the same language as the default player language
|
|
138
|
+
if ($(this).attr('srclang')) {
|
|
139
|
+
trackLang = $(this).attr('srclang');
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
trackLang = thisObj.lang;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if ($(this).attr('label')) {
|
|
146
|
+
trackLabel = $(this).attr('label');
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
trackLabel = thisObj.getLanguageName(trackLang);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if ($(this).attr('default')) {
|
|
153
|
+
isDefault = true;
|
|
154
|
+
}
|
|
155
|
+
else if (trackLang === thisObj.lang) {
|
|
156
|
+
// There is no @default attribute,
|
|
157
|
+
// but this is the user's/browser's default language
|
|
158
|
+
// so make it the default caption track
|
|
159
|
+
isDefault = true;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
isDefault = false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (isDefault) {
|
|
166
|
+
// this.captionLang will also be the default language for non-caption tracks
|
|
167
|
+
thisObj.captionLang = trackLang;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
thisObj.tracks.push({
|
|
171
|
+
'kind': $(this).attr('kind'),
|
|
172
|
+
'src': $(this).attr('src'),
|
|
173
|
+
'language': trackLang,
|
|
174
|
+
'label': trackLabel,
|
|
175
|
+
'def': isDefault
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// check to see if any HTML caption or subitle tracks were found.
|
|
181
|
+
captionTracks = this.$media.find('track[kind="captions"],track[kind="subtitles"]');
|
|
182
|
+
if (captionTracks.length) {
|
|
183
|
+
// HTML captions or subtitles were found. Use those.
|
|
184
|
+
deferred.resolve();
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
// if this is a youtube or vimeo player, check there for captions/subtitles
|
|
188
|
+
if (this.player === 'youtube') {
|
|
189
|
+
this.getYouTubeCaptionTracks(this.youTubeId).then(function() {
|
|
190
|
+
deferred.resolve();
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
else if (this.player === 'vimeo') {
|
|
194
|
+
this.getVimeoCaptionTracks().then(function() {
|
|
195
|
+
deferred.resolve();
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
// this is neither YouTube nor Vimeo
|
|
200
|
+
// there just ain't no caption tracks
|
|
201
|
+
deferred.resolve();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return promise;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
AblePlayer.prototype.setupCaptions = function (track, trackLang, trackLabel, cues) {
|
|
208
|
+
|
|
209
|
+
var thisObj, inserted, i, capLabel;
|
|
210
|
+
|
|
211
|
+
thisObj = this;
|
|
212
|
+
|
|
213
|
+
if (typeof cues === 'undefined') {
|
|
214
|
+
cues = null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
this.hasCaptions = true;
|
|
218
|
+
|
|
219
|
+
// Remove 'default' attribute from all <track> elements
|
|
220
|
+
// This data has already been saved to this.tracks
|
|
221
|
+
// and some browsers will display the default captions, despite all standard efforts to suppress them
|
|
222
|
+
this.$media.find('track').removeAttr('default');
|
|
223
|
+
|
|
224
|
+
// caption cues from WebVTT are used to build a transcript for both audio and video
|
|
225
|
+
// but captions are currently only supported for video
|
|
226
|
+
if (this.mediaType === 'video') {
|
|
227
|
+
|
|
228
|
+
if (!(this.usingYouTubeCaptions || this.usingVimeoCaptions)) {
|
|
229
|
+
// create a pair of nested divs for displaying captions
|
|
230
|
+
// includes aria-hidden="true" because otherwise
|
|
231
|
+
// captions being added and removed causes sporadic changes to focus in JAWS
|
|
232
|
+
// (not a problem in NVDA or VoiceOver)
|
|
233
|
+
if (!this.$captionsDiv) {
|
|
234
|
+
this.$captionsDiv = $('<div>',{
|
|
235
|
+
'class': 'able-captions',
|
|
236
|
+
});
|
|
237
|
+
this.$captionsWrapper = $('<div>',{
|
|
238
|
+
'class': 'able-captions-wrapper',
|
|
239
|
+
'aria-hidden': 'true'
|
|
240
|
+
}).hide();
|
|
241
|
+
if (this.prefCaptionsPosition === 'below') {
|
|
242
|
+
this.$captionsWrapper.addClass('able-captions-below');
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
this.$captionsWrapper.addClass('able-captions-overlay');
|
|
246
|
+
}
|
|
247
|
+
this.$captionsWrapper.append(this.$captionsDiv);
|
|
248
|
+
this.$vidcapContainer.append(this.$captionsWrapper);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
this.currentCaption = -1;
|
|
254
|
+
if (this.prefCaptions === 1) {
|
|
255
|
+
// Captions default to on.
|
|
256
|
+
this.captionsOn = true;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
this.captionsOn = false;
|
|
260
|
+
}
|
|
261
|
+
if (this.captions.length === 0) { // this is the first
|
|
262
|
+
this.captions.push({
|
|
263
|
+
'cues': cues,
|
|
264
|
+
'language': trackLang,
|
|
265
|
+
'label': trackLabel,
|
|
266
|
+
'def': track.def
|
|
267
|
+
});
|
|
268
|
+
this.captionLabels.push(trackLabel);
|
|
269
|
+
}
|
|
270
|
+
else { // there are already tracks in the array
|
|
271
|
+
inserted = false;
|
|
272
|
+
for (i = 0; i < this.captions.length; i++) {
|
|
273
|
+
capLabel = this.captionLabels[i];
|
|
274
|
+
if (trackLabel.toLowerCase() < this.captionLabels[i].toLowerCase()) {
|
|
275
|
+
// insert before track i
|
|
276
|
+
this.captions.splice(i,0,{
|
|
277
|
+
'cues': cues,
|
|
278
|
+
'language': trackLang,
|
|
279
|
+
'label': trackLabel,
|
|
280
|
+
'def': track.def
|
|
281
|
+
});
|
|
282
|
+
this.captionLabels.splice(i,0,trackLabel);
|
|
283
|
+
inserted = true;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (!inserted) {
|
|
288
|
+
// just add track to the end
|
|
289
|
+
this.captions.push({
|
|
290
|
+
'cues': cues,
|
|
291
|
+
'language': trackLang,
|
|
292
|
+
'label': trackLabel,
|
|
293
|
+
'def': track.def
|
|
294
|
+
});
|
|
295
|
+
this.captionLabels.push(trackLabel);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
AblePlayer.prototype.setupDescriptions = function (track, cues, trackLang) {
|
|
301
|
+
|
|
302
|
+
// called via setupTracks() only if there is track with kind="descriptions"
|
|
303
|
+
// prepares for delivery of text description , in case it's needed
|
|
304
|
+
// whether and how it's delivered is controlled within description.js > initDescription()
|
|
305
|
+
|
|
306
|
+
this.hasClosedDesc = true;
|
|
307
|
+
this.currentDescription = -1;
|
|
308
|
+
this.descriptions.push({
|
|
309
|
+
cues: cues,
|
|
310
|
+
language: trackLang
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
AblePlayer.prototype.setupChapters = function (track, cues, trackLang) {
|
|
315
|
+
|
|
316
|
+
// NOTE: WebVTT supports nested timestamps (to form an outline)
|
|
317
|
+
// This is not currently supported.
|
|
318
|
+
|
|
319
|
+
this.hasChapters = true;
|
|
320
|
+
|
|
321
|
+
this.chapters.push({
|
|
322
|
+
cues: cues,
|
|
323
|
+
language: trackLang
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
AblePlayer.prototype.setupMetadata = function(track, cues) {
|
|
328
|
+
|
|
329
|
+
if (this.metaType === 'text') {
|
|
330
|
+
// Metadata is only supported if data-meta-div is provided
|
|
331
|
+
// The player does not display metadata internally
|
|
332
|
+
if (this.metaDiv) {
|
|
333
|
+
if ($('#' + this.metaDiv)) {
|
|
334
|
+
// container exists
|
|
335
|
+
this.$metaDiv = $('#' + this.metaDiv);
|
|
336
|
+
this.hasMeta = true;
|
|
337
|
+
this.meta = cues;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else if (this.metaType === 'selector') {
|
|
342
|
+
this.hasMeta = true;
|
|
343
|
+
this.visibleSelectors = [];
|
|
344
|
+
this.meta = cues;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
AblePlayer.prototype.loadTextObject = function(src) {
|
|
349
|
+
|
|
350
|
+
// TODO: Incorporate the following function, moved from setupTracks()
|
|
351
|
+
// convert XMl/TTML captions file
|
|
352
|
+
/*
|
|
353
|
+
if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml'))) {
|
|
354
|
+
trackContents = thisObj.ttml2webvtt(trackText);
|
|
355
|
+
}
|
|
356
|
+
*/
|
|
357
|
+
var deferred, promise, thisObj, $tempDiv;
|
|
358
|
+
|
|
359
|
+
deferred = new $.Deferred();
|
|
360
|
+
promise = deferred.promise();
|
|
361
|
+
thisObj = this;
|
|
362
|
+
|
|
363
|
+
// create a temp div for holding data
|
|
364
|
+
$tempDiv = $('<div>',{
|
|
365
|
+
style: 'display:none'
|
|
366
|
+
});
|
|
367
|
+
$tempDiv.load(src, function (trackText, status, req) {
|
|
368
|
+
if (status === 'error') {
|
|
369
|
+
if (thisObj.debug) {
|
|
370
|
+
console.log ('error reading file ' + src + ': ' + status);
|
|
371
|
+
}
|
|
372
|
+
deferred.fail();
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
deferred.resolve(src, trackText);
|
|
376
|
+
}
|
|
377
|
+
$tempDiv.remove();
|
|
378
|
+
});
|
|
379
|
+
return promise;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
AblePlayer.prototype.setupAltCaptions = function() {
|
|
383
|
+
|
|
384
|
+
// setup captions from an alternative source (not <track> elements)
|
|
385
|
+
// only do this if no <track> captions are provided
|
|
386
|
+
// currently supports: YouTube, Vimeo
|
|
387
|
+
var deferred = new $.Deferred();
|
|
388
|
+
var promise = deferred.promise();
|
|
389
|
+
if (this.captions.length === 0) {
|
|
390
|
+
if (this.player === 'youtube' && this.usingYouTubeCaptions) {
|
|
391
|
+
this.setupYouTubeCaptions().done(function() {
|
|
392
|
+
deferred.resolve();
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
else if (this.player === 'vimeo' && this.usingVimeoCaptions) {
|
|
396
|
+
this.setupVimeoCaptions().done(function() {
|
|
397
|
+
deferred.resolve();
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
else {
|
|
402
|
+
// repeat for other alt sources once supported (e.g., Vimeo, DailyMotion)
|
|
403
|
+
deferred.resolve();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else { // there are <track> captions, so no need for alt source captions
|
|
407
|
+
deferred.resolve();
|
|
408
|
+
}
|
|
409
|
+
return promise;
|
|
410
|
+
};
|
|
311
411
|
|
|
312
412
|
})(jQuery);
|