@brightspace-ui/labs 2.63.0 → 2.63.1
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.
- package/demo/components/media-player/static/sample-vtt-en-descriptions.vtt +7 -0
- package/demo/components/media-player/static/sample-vtt-fr-descriptions.vtt +7 -0
- package/package.json +1 -1
- package/src/components/media-player/README.md +26 -1
- package/src/components/media-player/media-player-audio-bars.js +8 -8
- package/src/components/media-player/media-player-audio-descriptions.js +350 -0
- package/src/components/media-player/media-player.js +169 -145
- package/src/lang/ar.js +6 -0
- package/src/lang/ca.js +6 -0
- package/src/lang/cy.js +6 -0
- package/src/lang/da.js +6 -0
- package/src/lang/de.js +6 -0
- package/src/lang/en-gb.js +6 -0
- package/src/lang/en.js +6 -0
- package/src/lang/es-es.js +6 -0
- package/src/lang/es.js +6 -0
- package/src/lang/fr-fr.js +6 -0
- package/src/lang/fr-on.js +6 -0
- package/src/lang/fr.js +6 -0
- package/src/lang/haw.js +6 -0
- package/src/lang/hi.js +6 -0
- package/src/lang/ja.js +6 -0
- package/src/lang/ko.js +6 -0
- package/src/lang/mi.js +6 -0
- package/src/lang/nl.js +6 -0
- package/src/lang/pl.js +6 -0
- package/src/lang/pt.js +6 -0
- package/src/lang/ru.js +6 -0
- package/src/lang/sv.js +6 -0
- package/src/lang/th.js +6 -0
- package/src/lang/tr.js +6 -0
- package/src/lang/ur.js +6 -0
- package/src/lang/vi.js +6 -0
- package/src/lang/zh-cn.js +6 -0
- package/src/lang/zh-tw.js +6 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@brightspace-ui/core/components/alert/alert.js';
|
|
2
1
|
import '@brightspace-ui/core/components/button/button-icon.js';
|
|
3
2
|
import '@brightspace-ui/core/components/colors/colors.js';
|
|
4
3
|
import '@brightspace-ui/core/components/dropdown/dropdown.js';
|
|
@@ -10,10 +9,10 @@ import '@brightspace-ui/core/components/menu/menu.js';
|
|
|
10
9
|
import '@brightspace-ui/core/components/menu/menu-item.js';
|
|
11
10
|
import '@brightspace-ui/core/components/menu/menu-item-link.js';
|
|
12
11
|
import '@brightspace-ui/core/components/menu/menu-item-radio.js';
|
|
13
|
-
import '@brightspace-ui/core/components/offscreen/offscreen.js';
|
|
14
12
|
import './slider-bar.js';
|
|
15
13
|
import 'webvtt-parser';
|
|
16
14
|
import './media-player-audio-bars.js';
|
|
15
|
+
import { AUDIO_DESCRIPTION_REPLAY_KEY, AUDIO_DESCRIPTION_SKIP_KEY, AUDIO_DESCRIPTION_TRACK_KIND, MediaPlayerAudioDescriptionsMixin } from './media-player-audio-descriptions.js';
|
|
17
16
|
import { css, html, LitElement, unsafeCSS } from 'lit';
|
|
18
17
|
import { classMap } from 'lit/directives/class-map.js';
|
|
19
18
|
import fullscreenApi from './fullscreen-api.js';
|
|
@@ -33,7 +32,9 @@ const HIDE_DELAY_MS = 3000;
|
|
|
33
32
|
const KEY_BINDINGS = {
|
|
34
33
|
play: 'k',
|
|
35
34
|
mute: 'm',
|
|
36
|
-
fullscreen: 'f'
|
|
35
|
+
fullscreen: 'f',
|
|
36
|
+
replayAudioDescription: AUDIO_DESCRIPTION_REPLAY_KEY,
|
|
37
|
+
skipAudioDescription: AUDIO_DESCRIPTION_SKIP_KEY
|
|
37
38
|
};
|
|
38
39
|
const MIN_TRACK_WIDTH_PX = 250;
|
|
39
40
|
const IS_IOS = /iPad|iPhone|iPod/.test(navigator.platform);
|
|
@@ -59,7 +60,7 @@ const FUSE_OPTIONS = options => ({
|
|
|
59
60
|
threshold: 0.1,
|
|
60
61
|
...options
|
|
61
62
|
});
|
|
62
|
-
const SEARCH_CONTAINER_HOVER_CLASS = '
|
|
63
|
+
const SEARCH_CONTAINER_HOVER_CLASS = 'search-container-hover';
|
|
63
64
|
const DEFAULT_PREVIEW_WIDTH = 160;
|
|
64
65
|
const DEFAULT_PREVIEW_HEIGHT = 90;
|
|
65
66
|
|
|
@@ -75,7 +76,7 @@ const tryParseUrlExpiry = url => {
|
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
78
|
|
|
78
|
-
class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
79
|
+
class MediaPlayer extends LocalizeLabsElement(MediaPlayerAudioDescriptionsMixin(RtlMixin(LitElement))) {
|
|
79
80
|
|
|
80
81
|
static properties = {
|
|
81
82
|
allowDownload: { type: Boolean, attribute: 'allow-download', reflect: true },
|
|
@@ -94,36 +95,36 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
94
95
|
disableSetPreferences: { type: Boolean, attribute: 'disable-set-preferences' },
|
|
95
96
|
transcriptViewerOn: { type: Boolean, attribute: 'transcript-viewer-on' },
|
|
96
97
|
playInView: { type: Boolean, attribute: 'play-in-view' },
|
|
97
|
-
_chapters: {
|
|
98
|
-
_currentTime: {
|
|
99
|
-
_duration: {
|
|
100
|
-
_heightPixels: {
|
|
101
|
-
_hoverTime: {
|
|
102
|
-
_hovering: {
|
|
103
|
-
_loading: {
|
|
104
|
-
_maintainHeight: {
|
|
105
|
-
_mediaContainerAspectRatio: {
|
|
106
|
-
_message: {
|
|
107
|
-
_muted: {
|
|
108
|
-
_playing: {
|
|
109
|
-
_posterVisible: {
|
|
110
|
-
_recentlyShowedCustomControls: {
|
|
111
|
-
_searchResults: {
|
|
112
|
-
_selectedQuality: {
|
|
113
|
-
_selectedSpeed: {
|
|
114
|
-
_selectedTrackIdentifier: {
|
|
115
|
-
_sources: {
|
|
116
|
-
_thumbnailsImage: {
|
|
117
|
-
_timelinePreviewOffset: {
|
|
118
|
-
_trackFontSizeRem: {
|
|
119
|
-
_timeFontSizeRem: {
|
|
120
|
-
_trackText: {
|
|
121
|
-
_tracks: {
|
|
122
|
-
_usingVolumeContainer: {
|
|
123
|
-
_volume: {
|
|
98
|
+
_chapters: { state: true },
|
|
99
|
+
_currentTime: { state: true },
|
|
100
|
+
_duration: { state: true },
|
|
101
|
+
_heightPixels: { state: true },
|
|
102
|
+
_hoverTime: { state: true },
|
|
103
|
+
_hovering: { state: true },
|
|
104
|
+
_loading: { state: true },
|
|
105
|
+
_maintainHeight: { state: true },
|
|
106
|
+
_mediaContainerAspectRatio: { state: true },
|
|
107
|
+
_message: { state: true },
|
|
108
|
+
_muted: { state: true },
|
|
109
|
+
_playing: { state: true },
|
|
110
|
+
_posterVisible: { state: true },
|
|
111
|
+
_recentlyShowedCustomControls: { state: true },
|
|
112
|
+
_searchResults: { state: true },
|
|
113
|
+
_selectedQuality: { state: true },
|
|
114
|
+
_selectedSpeed: { state: true },
|
|
115
|
+
_selectedTrackIdentifier: { state: true },
|
|
116
|
+
_sources: { state: true },
|
|
117
|
+
_thumbnailsImage: { state: true },
|
|
118
|
+
_timelinePreviewOffset: { state: true },
|
|
119
|
+
_trackFontSizeRem: { state: true },
|
|
120
|
+
_timeFontSizeRem: { state: true },
|
|
121
|
+
_trackText: { state: true },
|
|
122
|
+
_tracks: { state: true },
|
|
123
|
+
_usingVolumeContainer: { state: true },
|
|
124
|
+
_volume: { state: true },
|
|
124
125
|
};
|
|
125
126
|
|
|
126
|
-
static styles = [labelStyles, css`
|
|
127
|
+
static styles = [super.styles, labelStyles, css`
|
|
127
128
|
:host {
|
|
128
129
|
display: block;
|
|
129
130
|
min-height: 140px;
|
|
@@ -134,7 +135,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
134
135
|
display: none;
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
#
|
|
138
|
+
#media-container {
|
|
138
139
|
align-items: center;
|
|
139
140
|
justify-content: center;
|
|
140
141
|
/* This max-height prevents the video from growing out of bounds and appearing cut off inside of ISF iframes */
|
|
@@ -144,17 +145,17 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
144
145
|
width: 100%;
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
.
|
|
148
|
+
.type-is-audio {
|
|
148
149
|
background-color: #ffffff;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
.
|
|
152
|
+
.type-is-video {
|
|
152
153
|
background-color: #000000;
|
|
153
154
|
color: #ffffff;
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
|
|
157
|
-
#
|
|
158
|
+
#video {
|
|
158
159
|
display: block;
|
|
159
160
|
height: 100%;
|
|
160
161
|
max-height: var(--d2l-labs-media-player-video-max-height, 100vh);
|
|
@@ -163,7 +164,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
163
164
|
width: 100%;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
#
|
|
167
|
+
#video-poster {
|
|
167
168
|
background-color: #000000;
|
|
168
169
|
cursor: pointer;
|
|
169
170
|
height: 100%;
|
|
@@ -173,7 +174,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
173
174
|
z-index: 1;
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
#
|
|
177
|
+
#video-poster-play-button {
|
|
177
178
|
background-color: rgba(0, 0, 0, 0.69);
|
|
178
179
|
border: none;
|
|
179
180
|
border-radius: 50%;
|
|
@@ -183,7 +184,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
183
184
|
z-index: 2;
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
#
|
|
187
|
+
#video-poster-play-button[transcript] {
|
|
187
188
|
background-color: rgba(0, 0, 0, 0.69);
|
|
188
189
|
border: none;
|
|
189
190
|
border-radius: 50%;
|
|
@@ -197,11 +198,11 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
|
|
200
|
-
#
|
|
201
|
+
#video-poster-play-button > d2l-icon {
|
|
201
202
|
color: #ffffff;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
#
|
|
205
|
+
#media-controls {
|
|
205
206
|
bottom: 0;
|
|
206
207
|
position: absolute;
|
|
207
208
|
transition: bottom 500ms ease;
|
|
@@ -209,18 +210,18 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
209
210
|
z-index: 2;
|
|
210
211
|
}
|
|
211
212
|
|
|
212
|
-
.
|
|
213
|
+
.type-is-audio #media-controls {
|
|
213
214
|
background-color: #ffffff;
|
|
214
215
|
}
|
|
215
|
-
.
|
|
216
|
+
.type-is-video #media-controls {
|
|
216
217
|
background-color: rgba(0, 0, 0, 0.69);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
#
|
|
220
|
+
#media-controls.hidden {
|
|
220
221
|
bottom: -8rem;
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
#
|
|
224
|
+
#seek-bar {
|
|
224
225
|
--d2l-knob-focus-color: #ffffff;
|
|
225
226
|
--d2l-knob-focus-size: 4px;
|
|
226
227
|
--d2l-knob-size: 16px;
|
|
@@ -232,11 +233,11 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
232
233
|
z-index: 1;
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
#
|
|
236
|
+
#seek-bar:focus {
|
|
236
237
|
--d2l-knob-box-shadow: 0 2px 6px 3px rgba(0, 0, 0, 1);
|
|
237
238
|
}
|
|
238
239
|
|
|
239
|
-
#
|
|
240
|
+
#buttons {
|
|
240
241
|
align-items: center;
|
|
241
242
|
direction: ltr;
|
|
242
243
|
display: flex;
|
|
@@ -245,12 +246,12 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
245
246
|
margin-left: 6px;
|
|
246
247
|
}
|
|
247
248
|
|
|
248
|
-
[dir="rtl"] #
|
|
249
|
+
[dir="rtl"] #buttons {
|
|
249
250
|
margin-left: 0;
|
|
250
251
|
margin-right: 6px;
|
|
251
252
|
}
|
|
252
253
|
|
|
253
|
-
.
|
|
254
|
+
.flex-filler {
|
|
254
255
|
flex: auto;
|
|
255
256
|
}
|
|
256
257
|
|
|
@@ -260,15 +261,15 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
260
261
|
margin: 6px 6px 6px 0;
|
|
261
262
|
}
|
|
262
263
|
|
|
263
|
-
#
|
|
264
|
+
#time:hover {
|
|
264
265
|
cursor: auto;
|
|
265
266
|
}
|
|
266
267
|
|
|
267
|
-
#
|
|
268
|
+
#volume-container {
|
|
268
269
|
position: relative;
|
|
269
270
|
}
|
|
270
271
|
|
|
271
|
-
#
|
|
272
|
+
#volume-level-container {
|
|
272
273
|
bottom: calc(1.8rem + 6px);
|
|
273
274
|
height: 11px;
|
|
274
275
|
left: 0;
|
|
@@ -277,11 +278,11 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
277
278
|
z-index: 2;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
#
|
|
281
|
+
#volume-level-container.hidden {
|
|
281
282
|
left: -10000px;
|
|
282
283
|
}
|
|
283
284
|
|
|
284
|
-
#
|
|
285
|
+
#volume-level-background {
|
|
285
286
|
align-items: center;
|
|
286
287
|
background-color: rgba(0, 0, 0, 0.69);
|
|
287
288
|
border-radius: 0 0.3rem 0.3rem 0;
|
|
@@ -295,12 +296,12 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
295
296
|
width: 6rem;
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
#
|
|
299
|
+
#volume-slider-container {
|
|
299
300
|
height: 100%;
|
|
300
301
|
width: 100%;
|
|
301
302
|
}
|
|
302
303
|
|
|
303
|
-
#
|
|
304
|
+
#volume-slider {
|
|
304
305
|
--d2l-knob-focus-color: #ffffff;
|
|
305
306
|
--d2l-knob-focus-size: 0.25rem;
|
|
306
307
|
--d2l-knob-size: 0.8rem;
|
|
@@ -309,11 +310,11 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
309
310
|
top: calc(0.5rem + 1px);
|
|
310
311
|
}
|
|
311
312
|
|
|
312
|
-
.
|
|
313
|
+
.rotated {
|
|
313
314
|
transform: rotate(-90deg);
|
|
314
315
|
}
|
|
315
316
|
|
|
316
|
-
#
|
|
317
|
+
#audio-bars-container {
|
|
317
318
|
align-items: center;
|
|
318
319
|
display: flex;
|
|
319
320
|
flex-wrap: nowrap;
|
|
@@ -329,7 +330,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
329
330
|
height: 2rem;
|
|
330
331
|
}
|
|
331
332
|
|
|
332
|
-
#
|
|
333
|
+
#track-container {
|
|
333
334
|
align-items: center;
|
|
334
335
|
color: #ffffff;
|
|
335
336
|
display: flex;
|
|
@@ -342,7 +343,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
342
343
|
}
|
|
343
344
|
|
|
344
345
|
@media screen and (min-width: 768px) {
|
|
345
|
-
#
|
|
346
|
+
#track-container > div {
|
|
346
347
|
align-items: center;
|
|
347
348
|
display: flex;
|
|
348
349
|
justify-content: center;
|
|
@@ -352,7 +353,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
352
353
|
}
|
|
353
354
|
|
|
354
355
|
@media screen and (max-width: 767px) {
|
|
355
|
-
#
|
|
356
|
+
#track-container > div {
|
|
356
357
|
align-items: center;
|
|
357
358
|
display: flex;
|
|
358
359
|
justify-content: center;
|
|
@@ -360,7 +361,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
363
|
|
|
363
|
-
#
|
|
364
|
+
#track-container > div > span {
|
|
364
365
|
background-color: rgba(0, 0, 0, 0.69);
|
|
365
366
|
box-shadow: 0.3rem 0 0 rgba(0, 0, 0, 0.69), -0.3rem 0 0 rgba(0, 0, 0, 0.69);
|
|
366
367
|
color: white;
|
|
@@ -368,12 +369,12 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
368
369
|
white-space: pre-wrap;
|
|
369
370
|
}
|
|
370
371
|
|
|
371
|
-
#
|
|
372
|
+
#audio-play-button-container {
|
|
372
373
|
background-color: white;
|
|
373
374
|
position: absolute;
|
|
374
375
|
}
|
|
375
376
|
|
|
376
|
-
#
|
|
377
|
+
#audio-play-button {
|
|
377
378
|
background-color: transparent;
|
|
378
379
|
border: none;
|
|
379
380
|
border-radius: 12px;
|
|
@@ -381,26 +382,26 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
381
382
|
padding: 2px;
|
|
382
383
|
}
|
|
383
384
|
|
|
384
|
-
#
|
|
385
|
+
#audio-play-button:focus {
|
|
385
386
|
outline: none;
|
|
386
387
|
}
|
|
387
388
|
|
|
388
|
-
#
|
|
389
|
+
#audio-play-button:hover {
|
|
389
390
|
background: var(--d2l-color-mica);
|
|
390
391
|
background-clip: content-box;
|
|
391
392
|
cursor: pointer;
|
|
392
393
|
}
|
|
393
394
|
|
|
394
|
-
#
|
|
395
|
+
#audio-play-button:${unsafeCSS(getFocusPseudoClass())} {
|
|
395
396
|
border: 2px solid var(--d2l-color-celestine);
|
|
396
397
|
}
|
|
397
398
|
|
|
398
|
-
#
|
|
399
|
+
#audio-play-button > d2l-icon {
|
|
399
400
|
height: 2.75rem;
|
|
400
401
|
width: 2.75rem;
|
|
401
402
|
}
|
|
402
403
|
|
|
403
|
-
.
|
|
404
|
+
.chapter-marker, .chapter-marker-highlight {
|
|
404
405
|
cursor: pointer;
|
|
405
406
|
height: 6px;
|
|
406
407
|
pointer-events: none;
|
|
@@ -410,27 +411,27 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
410
411
|
z-index: 2;
|
|
411
412
|
}
|
|
412
413
|
|
|
413
|
-
.
|
|
414
|
+
.chapter-marker {
|
|
414
415
|
background-color: var(--d2l-color-ferrite);
|
|
415
416
|
}
|
|
416
417
|
|
|
417
|
-
.
|
|
418
|
+
.chapter-marker-highlight {
|
|
418
419
|
background-color: var(--d2l-color-celestine-minus-1);
|
|
419
420
|
}
|
|
420
421
|
|
|
421
|
-
.
|
|
422
|
+
.chapter-marker[theme="dark"] {
|
|
422
423
|
background-color: white;
|
|
423
424
|
}
|
|
424
425
|
|
|
425
|
-
#
|
|
426
|
+
#search-container {
|
|
426
427
|
align-items: center;
|
|
427
428
|
display: flex;
|
|
428
429
|
}
|
|
429
|
-
#
|
|
430
|
+
#search-container.search-container-hidden {
|
|
430
431
|
display: none;
|
|
431
432
|
}
|
|
432
433
|
|
|
433
|
-
#
|
|
434
|
+
#search-container #search-input {
|
|
434
435
|
border-color: rgba(48, 52, 54, 0.1);
|
|
435
436
|
border-radius: 20px;
|
|
436
437
|
color: var(--d2l-color-ferrite);
|
|
@@ -444,19 +445,19 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
444
445
|
width: 0;
|
|
445
446
|
}
|
|
446
447
|
|
|
447
|
-
#
|
|
448
|
+
#search-container #search-input[theme="dark"] {
|
|
448
449
|
background-color: rgba(24, 26, 27, 0.15);
|
|
449
450
|
color: rgb(206, 216, 225);
|
|
450
451
|
}
|
|
451
452
|
|
|
452
|
-
#
|
|
453
|
-
#
|
|
453
|
+
#search-container #search-input:focus,
|
|
454
|
+
#search-container #search-input:active {
|
|
454
455
|
box-shadow: rgb(24 26 27) 0 0 1px;
|
|
455
456
|
outline-color: initial;
|
|
456
457
|
}
|
|
457
458
|
|
|
458
|
-
#
|
|
459
|
-
#
|
|
459
|
+
#search-container:hover #search-input,
|
|
460
|
+
#search-container.search-container-hover #search-input {
|
|
460
461
|
height: 1.2rem;
|
|
461
462
|
opacity: 1;
|
|
462
463
|
padding: 0 0.35rem;
|
|
@@ -464,21 +465,21 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
464
465
|
width: 6rem;
|
|
465
466
|
}
|
|
466
467
|
|
|
467
|
-
#
|
|
468
|
+
#timeline-markers-container {
|
|
468
469
|
position: absolute;
|
|
469
470
|
top: -9px;
|
|
470
471
|
transition: all 0.2s;
|
|
471
472
|
width: 100%;
|
|
472
473
|
}
|
|
473
474
|
|
|
474
|
-
#
|
|
475
|
+
#thumbnails-preview-container {
|
|
475
476
|
bottom: 60px;
|
|
476
477
|
position: absolute;
|
|
477
478
|
transform: translateX(-50%);
|
|
478
479
|
z-index: 2;
|
|
479
480
|
}
|
|
480
481
|
|
|
481
|
-
#
|
|
482
|
+
#thumbnails-preview-chapter {
|
|
482
483
|
background: #00000072;
|
|
483
484
|
position: absolute;
|
|
484
485
|
text-align: center;
|
|
@@ -487,7 +488,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
487
488
|
z-index: 2;
|
|
488
489
|
}
|
|
489
490
|
|
|
490
|
-
#
|
|
491
|
+
#thumbnails-preview-time {
|
|
491
492
|
background: #00000042;
|
|
492
493
|
bottom: 3px;
|
|
493
494
|
font-size: 14px;
|
|
@@ -499,14 +500,14 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
499
500
|
z-index: 2;
|
|
500
501
|
}
|
|
501
502
|
|
|
502
|
-
#
|
|
503
|
+
#thumbnails-preview-image {
|
|
503
504
|
background-repeat: no-repeat;
|
|
504
505
|
position: relative;
|
|
505
506
|
width: 100%;
|
|
506
507
|
z-index: 2;
|
|
507
508
|
}
|
|
508
509
|
|
|
509
|
-
.
|
|
510
|
+
.search-marker {
|
|
510
511
|
color: var(--d2l-color-ferrite);
|
|
511
512
|
cursor: pointer;
|
|
512
513
|
height: 6px;
|
|
@@ -517,11 +518,11 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
517
518
|
z-index: 2;
|
|
518
519
|
}
|
|
519
520
|
|
|
520
|
-
.
|
|
521
|
+
.search-marker[theme="dark"] {
|
|
521
522
|
color: white;
|
|
522
523
|
}
|
|
523
524
|
|
|
524
|
-
.
|
|
525
|
+
.full-area-centered {
|
|
525
526
|
align-items: center;
|
|
526
527
|
display: flex;
|
|
527
528
|
height: 100%;
|
|
@@ -533,18 +534,18 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
533
534
|
z-index: 2;
|
|
534
535
|
}
|
|
535
536
|
|
|
536
|
-
#
|
|
537
|
+
#alert-inner {
|
|
537
538
|
display: flex;
|
|
538
539
|
flex-direction: row;
|
|
539
540
|
justify-content: flex-start;
|
|
540
541
|
}
|
|
541
542
|
|
|
542
|
-
#
|
|
543
|
+
#alert-inner > svg {
|
|
543
544
|
flex-shrink: 0;
|
|
544
545
|
margin-right: 0.5rem;
|
|
545
546
|
}
|
|
546
547
|
|
|
547
|
-
#
|
|
548
|
+
#alert-inner > span {
|
|
548
549
|
font-size: 1rem;
|
|
549
550
|
line-height: 2.1rem;
|
|
550
551
|
}
|
|
@@ -673,6 +674,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
673
674
|
if (this._media) {
|
|
674
675
|
this._media.currentTime = time;
|
|
675
676
|
}
|
|
677
|
+
this._resetAudioDescriptionCursor(time);
|
|
676
678
|
this._syncDisplayedTrackTextToSelectedTrack();
|
|
677
679
|
}
|
|
678
680
|
|
|
@@ -737,14 +739,14 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
737
739
|
if (sourceNodes.length < 1) console.warn('d2l-labs-media-player component requires source tags if src is not set');
|
|
738
740
|
}
|
|
739
741
|
|
|
740
|
-
this._mediaContainer = this.shadowRoot.getElementById('
|
|
741
|
-
this._playButton = this.shadowRoot.getElementById('
|
|
742
|
-
this._seekBar = this.shadowRoot.getElementById('
|
|
743
|
-
this._settingsMenu = this.shadowRoot.getElementById('
|
|
744
|
-
this._speedLevelBackground = this.shadowRoot.getElementById('
|
|
745
|
-
this._volumeSlider = this.shadowRoot.getElementById('
|
|
746
|
-
this._searchInput = this.shadowRoot.getElementById('
|
|
747
|
-
this._searchContainer = this.shadowRoot.getElementById('
|
|
742
|
+
this._mediaContainer = this.shadowRoot.getElementById('media-container');
|
|
743
|
+
this._playButton = this.shadowRoot.getElementById('play-button');
|
|
744
|
+
this._seekBar = this.shadowRoot.getElementById('seek-bar');
|
|
745
|
+
this._settingsMenu = this.shadowRoot.getElementById('settings-menu');
|
|
746
|
+
this._speedLevelBackground = this.shadowRoot.getElementById('speed-level-background');
|
|
747
|
+
this._volumeSlider = this.shadowRoot.getElementById('volume-slider');
|
|
748
|
+
this._searchInput = this.shadowRoot.getElementById('search-input');
|
|
749
|
+
this._searchContainer = this.shadowRoot.getElementById('search-container');
|
|
748
750
|
|
|
749
751
|
this._getMetadata();
|
|
750
752
|
|
|
@@ -803,11 +805,12 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
803
805
|
const trackContainerStyle = { bottom: this._hidingCustomControls() ? '12px' : 'calc(1.8rem + 38px)' };
|
|
804
806
|
const trackSpanStyle = { fontSize: `${this._trackFontSizeRem}rem`, lineHeight: `${this._trackFontSizeRem * 1.2}rem` };
|
|
805
807
|
|
|
806
|
-
const mediaContainerClass = { '
|
|
807
|
-
const mediaControlsClass = { '
|
|
808
|
+
const mediaContainerClass = { 'type-is-audio': this.mediaType === SOURCE_TYPES.audio, 'type-is-video': this.mediaType === SOURCE_TYPES.video };
|
|
809
|
+
const mediaControlsClass = { 'hidden': this._hidingCustomControls() };
|
|
808
810
|
const theme = this.mediaType === SOURCE_TYPES.video ? 'dark' : undefined;
|
|
809
|
-
const volumeLevelContainerClass = { '
|
|
810
|
-
const
|
|
811
|
+
const volumeLevelContainerClass = { 'hidden': !this._usingVolumeContainer || this._hidingCustomControls() };
|
|
812
|
+
const hideSearchForAudioDescriptions = this._audioDescriptionTracks.length > 0 && this._audioDescriptionControlsInMenu;
|
|
813
|
+
const searchContainerClass = { 'search-container-hidden' : !this._searchInstances[this._getSrclangFromTrackIdentifier(this._selectedTrackIdentifier)] || hideSearchForAudioDescriptions };
|
|
811
814
|
this._captionsMenuReturnItem?.setAttribute('text', (this.transcriptViewerOn ? this.localize('components:mediaPlayer:language') : this.localize('components:mediaPlayer:captions')));
|
|
812
815
|
|
|
813
816
|
const fullscreenButton = this.mediaType === SOURCE_TYPES.video ? html`<d2l-button-icon
|
|
@@ -822,27 +825,27 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
822
825
|
|
|
823
826
|
${this._getLoadingSpinnerView()}
|
|
824
827
|
|
|
825
|
-
<div id="
|
|
828
|
+
<div id="media-container" class=${classMap(mediaContainerClass)} style=${styleMap(mediaContainerStyle)} @mousemove=${this._onVideoContainerMouseMove} @keydown=${this._listenForKeyboard}>
|
|
826
829
|
${this.transcriptViewerOn ? this._renderTranscriptViewer() : ''}
|
|
827
830
|
${this._getMediaAreaView()}
|
|
828
831
|
|
|
829
832
|
${!this._trackText || this.transcriptViewerOn ? null : html`
|
|
830
|
-
<div id="
|
|
833
|
+
<div id="track-container" style=${styleMap(trackContainerStyle)} @click=${this._onTrackContainerClick}>
|
|
831
834
|
<div>
|
|
832
835
|
<span style=${styleMap(trackSpanStyle)} role="status">${this._trackText}</span>
|
|
833
836
|
</div>
|
|
834
837
|
</div>
|
|
835
838
|
`}
|
|
836
839
|
|
|
837
|
-
<div class=${classMap(mediaControlsClass)} id="
|
|
840
|
+
<div class=${classMap(mediaControlsClass)} id="media-controls" @mouseenter=${this._startHoveringControls} @mouseleave=${this._stopHoveringControls}>
|
|
838
841
|
${this._getTimelinePreview()}
|
|
839
|
-
<div id="
|
|
842
|
+
<div id="timeline-markers-container">
|
|
840
843
|
${this._getSearchResultsView()}
|
|
841
844
|
${this._getChapterMarkersView()}
|
|
842
845
|
</div>
|
|
843
846
|
${this.hideSeekBar ? '' : html`
|
|
844
847
|
<d2l-labs-slider-bar
|
|
845
|
-
id="
|
|
848
|
+
id="seek-bar"
|
|
846
849
|
fullWidth
|
|
847
850
|
solid
|
|
848
851
|
min="0"
|
|
@@ -857,10 +860,10 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
857
860
|
@hovering-end=${this._onHoverEnd}
|
|
858
861
|
></d2l-labs-slider-bar>
|
|
859
862
|
`}
|
|
860
|
-
<div id="
|
|
863
|
+
<div id="buttons">
|
|
861
864
|
<d2l-button-icon icon="${playIcon}" text="${playTooltip}" @click="${this._togglePlay}" theme="${ifDefined(theme)}"></d2l-button-icon>
|
|
862
865
|
|
|
863
|
-
<div id="
|
|
866
|
+
<div id="volume-container" @mouseenter="${this._startUsingVolumeContainer}" @mouseleave="${this._stopUsingVolumeContainer}" ?hidden="${IS_IOS}">
|
|
864
867
|
<d2l-button-icon
|
|
865
868
|
class="d2l-dropdown-opener"
|
|
866
869
|
icon="${volumeIcon}"
|
|
@@ -870,11 +873,11 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
870
873
|
@click="${this._toggleMute}"
|
|
871
874
|
@focus="${this._startUsingVolumeContainer}"
|
|
872
875
|
></d2l-button-icon>
|
|
873
|
-
<div id="
|
|
874
|
-
<div class="
|
|
875
|
-
<div id="
|
|
876
|
+
<div id="volume-level-container" class=${classMap(volumeLevelContainerClass)}>
|
|
877
|
+
<div class="rotated" id="volume-level-background">
|
|
878
|
+
<div id="volume-slider-container">
|
|
876
879
|
<d2l-labs-slider-bar solid
|
|
877
|
-
id="
|
|
880
|
+
id="volume-slider"
|
|
878
881
|
vertical
|
|
879
882
|
value="${Math.round(this._volume * 100)}"
|
|
880
883
|
label="${this.localize('components:mediaPlayer:volumeSlider')}"
|
|
@@ -888,7 +891,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
888
891
|
</div>
|
|
889
892
|
</div>
|
|
890
893
|
|
|
891
|
-
<div id="
|
|
894
|
+
<div id="time"
|
|
892
895
|
aria-live="off"
|
|
893
896
|
aria-hidden="true"
|
|
894
897
|
tabindex="-1"
|
|
@@ -898,16 +901,18 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
898
901
|
${MediaPlayer._formatTime(this.currentTime)} / ${MediaPlayer._formatTime(this.duration)}
|
|
899
902
|
</div>
|
|
900
903
|
|
|
901
|
-
<div class="
|
|
904
|
+
<div class="flex-filler"></div>
|
|
905
|
+
|
|
906
|
+
${this._getAudioDescriptionsButtonView()}
|
|
902
907
|
|
|
903
908
|
<div
|
|
904
909
|
@mouseenter=${this._onSearchContainerHover}
|
|
905
910
|
@mouseleave=${this._onSearchContainerHover}
|
|
906
911
|
class=${classMap(searchContainerClass)}
|
|
907
|
-
id="
|
|
912
|
+
id="search-container"
|
|
908
913
|
><d2l-button-icon
|
|
909
914
|
icon="tier1:search"
|
|
910
|
-
id="
|
|
915
|
+
id="search-button"
|
|
911
916
|
text=${this.localize('components:mediaPlayer:showSearchInput')}
|
|
912
917
|
theme="${ifDefined(theme)}"
|
|
913
918
|
></d2l-button-icon>
|
|
@@ -915,7 +920,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
915
920
|
@blur=${this._onSearchInputBlur}
|
|
916
921
|
@focus=${this._onSearchInputFocus}
|
|
917
922
|
@input=${this._onSearchInputChanged}
|
|
918
|
-
id="
|
|
923
|
+
id="search-input"
|
|
919
924
|
placeholder="${this.localize('components:mediaPlayer:searchPlaceholder')}"
|
|
920
925
|
theme="${ifDefined(theme)}"
|
|
921
926
|
type="text"
|
|
@@ -923,9 +928,9 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
923
928
|
</div>
|
|
924
929
|
<d2l-dropdown>
|
|
925
930
|
<d2l-button-icon class="d2l-dropdown-opener" icon="tier1:gear" text="${this.localize('components:mediaPlayer:settings')}" theme="${ifDefined(theme)}"></d2l-button-icon>
|
|
926
|
-
<d2l-dropdown-menu id="
|
|
931
|
+
<d2l-dropdown-menu id="settings-menu" class="vdiff-target" no-pointer theme="${ifDefined(theme)}">
|
|
927
932
|
<d2l-menu label="${this.localize('components:mediaPlayer:settings')}" theme="${ifDefined(theme)}">
|
|
928
|
-
<d2l-menu-item id="
|
|
933
|
+
<d2l-menu-item id="playback-speeds" text="${this.localize('components:mediaPlayer:playbackSpeed')}">
|
|
929
934
|
<div slot="supporting">${this._selectedSpeed}</div>
|
|
930
935
|
<d2l-menu @d2l-menu-item-change=${this._onPlaybackSpeedsMenuItemChange} theme="${ifDefined(theme)}">
|
|
931
936
|
${PLAYBACK_SPEEDS.map(speed => html`
|
|
@@ -1011,9 +1016,9 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1011
1016
|
if (!this.shadowRoot) return null;
|
|
1012
1017
|
switch (this.mediaType) {
|
|
1013
1018
|
case SOURCE_TYPES.audio:
|
|
1014
|
-
return this.shadowRoot.getElementById('
|
|
1019
|
+
return this.shadowRoot.getElementById('audio');
|
|
1015
1020
|
case SOURCE_TYPES.video:
|
|
1016
|
-
return this.shadowRoot.getElementById('
|
|
1021
|
+
return this.shadowRoot.getElementById('video');
|
|
1017
1022
|
default:
|
|
1018
1023
|
return null;
|
|
1019
1024
|
}
|
|
@@ -1129,7 +1134,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1129
1134
|
const highlight = this._hovering && this._hoverTime >= this._chapters[0].time && (chapter.time === start || chapter.time === end);
|
|
1130
1135
|
return chapter.time > 0 ? html`
|
|
1131
1136
|
<div
|
|
1132
|
-
class=${highlight ? '
|
|
1137
|
+
class=${highlight ? 'chapter-marker-highlight' : 'chapter-marker'}
|
|
1133
1138
|
theme="${ifDefined(this._getTheme())}"
|
|
1134
1139
|
style=${styleMap({ left: `${this._getPercentageTime(chapter.time)}%` })}
|
|
1135
1140
|
></div>
|
|
@@ -1189,7 +1194,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1189
1194
|
|
|
1190
1195
|
_getLoadingSpinnerView() {
|
|
1191
1196
|
return this._loading ? html`
|
|
1192
|
-
<div class="
|
|
1197
|
+
<div class="full-area-centered">
|
|
1193
1198
|
<d2l-loading-spinner size="100"></d2l-loading-spinner>
|
|
1194
1199
|
</div>
|
|
1195
1200
|
` : null;
|
|
@@ -1204,7 +1209,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1204
1209
|
return html`
|
|
1205
1210
|
${this._getPosterView()}
|
|
1206
1211
|
<video
|
|
1207
|
-
id="
|
|
1212
|
+
id="video"
|
|
1208
1213
|
playsinline
|
|
1209
1214
|
webkit-playsinline
|
|
1210
1215
|
?autoplay="${this.autoplay}"
|
|
@@ -1233,7 +1238,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1233
1238
|
case SOURCE_TYPES.audio:
|
|
1234
1239
|
return html`
|
|
1235
1240
|
<audio
|
|
1236
|
-
id="
|
|
1241
|
+
id="audio"
|
|
1237
1242
|
?autoplay="${this.autoplay}"
|
|
1238
1243
|
?loop="${this.loop}"
|
|
1239
1244
|
crossorigin="${ifDefined(this.crossorigin)}"
|
|
@@ -1253,9 +1258,9 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1253
1258
|
<source @error=${this._onError}></source>
|
|
1254
1259
|
</audio>
|
|
1255
1260
|
${this.transcriptViewerOn ? null : html`
|
|
1256
|
-
<div id="
|
|
1257
|
-
<div id="
|
|
1258
|
-
<button id="
|
|
1261
|
+
<div id="audio-bars-container">
|
|
1262
|
+
<div id="audio-play-button-container">
|
|
1263
|
+
<button id="audio-play-button" title="${playTooltip}" aria-label="${playTooltip}" @click=${this._togglePlay}>
|
|
1259
1264
|
<d2l-icon icon="${playIcon}"></d2l-icon>
|
|
1260
1265
|
</button>
|
|
1261
1266
|
</div>
|
|
@@ -1331,7 +1336,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1331
1336
|
if (!this.poster || this.autoplay || !this._posterVisible) return;
|
|
1332
1337
|
|
|
1333
1338
|
const playIcon = !this._loading ? html`
|
|
1334
|
-
<button id="
|
|
1339
|
+
<button id="video-poster-play-button" aria-label=${this.localize('components:mediaPlayer:play')} title=${this.localize('components:mediaPlayer:play')} transcript="${ifDefined(this.transcriptViewerOn ? true : undefined)}"
|
|
1335
1340
|
@click=${this._onVideoClick}>
|
|
1336
1341
|
<d2l-icon icon="tier1:play" theme="${ifDefined(this._getTheme())}"></d2l-icon>
|
|
1337
1342
|
</button>
|
|
@@ -1340,7 +1345,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1340
1345
|
return html`
|
|
1341
1346
|
${playIcon}
|
|
1342
1347
|
<img
|
|
1343
|
-
id="
|
|
1348
|
+
id="video-poster"
|
|
1344
1349
|
src="${ifDefined(this.poster)}"
|
|
1345
1350
|
@click=${this._onVideoClick}
|
|
1346
1351
|
/>
|
|
@@ -1377,7 +1382,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1377
1382
|
return html`
|
|
1378
1383
|
<d2l-icon
|
|
1379
1384
|
@click=${this._onTimelineMarkerClick(result)}
|
|
1380
|
-
class="
|
|
1385
|
+
class="search-marker"
|
|
1381
1386
|
icon="tier1:subscribe-filled"
|
|
1382
1387
|
theme="${ifDefined(this._getTheme())}"
|
|
1383
1388
|
style=${styleMap({ left: `${this._getPercentageTime(result)}%` })}
|
|
@@ -1425,15 +1430,15 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1425
1430
|
|
|
1426
1431
|
if (!(this.thumbnails && this._thumbnailsImage))
|
|
1427
1432
|
return html`
|
|
1428
|
-
<div id="
|
|
1433
|
+
<div id="thumbnails-preview-container"
|
|
1429
1434
|
style="width: ${DEFAULT_PREVIEW_WIDTH}px; left: clamp(${DEFAULT_PREVIEW_WIDTH / 2}px, ${this._timelinePreviewOffset}%, calc(100% - ${DEFAULT_PREVIEW_WIDTH / 2}px));">
|
|
1430
1435
|
<div
|
|
1431
|
-
id="
|
|
1436
|
+
id="thumbnails-preview-image"
|
|
1432
1437
|
>
|
|
1433
|
-
<span id="
|
|
1438
|
+
<span id="thumbnails-preview-time">${MediaPlayer._formatTime(this._hoverTime)}</span>
|
|
1434
1439
|
</div>
|
|
1435
1440
|
${chapterTitleLabel &&
|
|
1436
|
-
html`<span class="d2l-label-text" id="
|
|
1441
|
+
html`<span class="d2l-label-text" id="thumbnails-preview-chapter" style="bottom: ${DEFAULT_PREVIEW_HEIGHT - 60}px">${chapterTitleLabel}</span>`}
|
|
1437
1442
|
</div>
|
|
1438
1443
|
`;
|
|
1439
1444
|
|
|
@@ -1456,16 +1461,16 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1456
1461
|
const column = thumbNum % columns;
|
|
1457
1462
|
|
|
1458
1463
|
return html`
|
|
1459
|
-
<div id="
|
|
1464
|
+
<div id="thumbnails-preview-container"
|
|
1460
1465
|
style="width: ${thumbWidth}px; left: clamp(${thumbWidth / 2}px, ${this._timelinePreviewOffset}%, calc(100% - ${thumbWidth / 2}px));">
|
|
1461
1466
|
<div
|
|
1462
|
-
id="
|
|
1467
|
+
id="thumbnails-preview-image"
|
|
1463
1468
|
style="height: ${thumbHeight}px; background: url(${this._thumbnailsImage.src}) ${-column * thumbWidth}px ${-row * thumbHeight}px / ${width}px ${height}px;"
|
|
1464
1469
|
>
|
|
1465
|
-
<span id="
|
|
1470
|
+
<span id="thumbnails-preview-time">${MediaPlayer._formatTime(this._hoverTime)}</span>
|
|
1466
1471
|
</div>
|
|
1467
1472
|
${chapterTitleLabel &&
|
|
1468
|
-
html`<span class="d2l-label-text" id="
|
|
1473
|
+
html`<span class="d2l-label-text" id="thumbnails-preview-chapter" style="bottom: ${thumbHeight}px">${chapterTitleLabel}</span>`}
|
|
1469
1474
|
</div>
|
|
1470
1475
|
`;
|
|
1471
1476
|
}
|
|
@@ -1486,7 +1491,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1486
1491
|
return this._tracks.length > 0 && !this.hideCaptionsSelection ? html`
|
|
1487
1492
|
<d2l-menu-item text="${this.transcriptViewerOn ? this.localize('components:mediaPlayer:language') : this.localize('components:mediaPlayer:captions')}">
|
|
1488
1493
|
<div slot="supporting">${this._selectedTrackLabel}</div>
|
|
1489
|
-
<d2l-menu id="
|
|
1494
|
+
<d2l-menu id="captions-menu"
|
|
1490
1495
|
@d2l-menu-item-change=${this._onTracksMenuItemChange} theme="${ifDefined(this._getTheme())}">
|
|
1491
1496
|
${this.transcriptViewerOn ? '' : html`
|
|
1492
1497
|
<d2l-menu-item-radio text="${this.localize('components:mediaPlayer:off')}" ?selected="${!this._selectedTrackIdentifier}"></d2l-menu-item-radio>`}
|
|
@@ -1522,6 +1527,12 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1522
1527
|
case KEY_BINDINGS.fullscreen:
|
|
1523
1528
|
this._toggleFullscreen();
|
|
1524
1529
|
break;
|
|
1530
|
+
case KEY_BINDINGS.replayAudioDescription:
|
|
1531
|
+
this._replayAudioDescription();
|
|
1532
|
+
break;
|
|
1533
|
+
case KEY_BINDINGS.skipAudioDescription:
|
|
1534
|
+
this._skipAudioDescription();
|
|
1535
|
+
break;
|
|
1525
1536
|
}
|
|
1526
1537
|
}
|
|
1527
1538
|
|
|
@@ -1592,6 +1603,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1592
1603
|
}
|
|
1593
1604
|
|
|
1594
1605
|
_onDragStartSeek() {
|
|
1606
|
+
this._cancelAudioDescription();
|
|
1595
1607
|
if (this._playing) {
|
|
1596
1608
|
this._media.pause();
|
|
1597
1609
|
this._pausedForSeekDrag = true;
|
|
@@ -1622,6 +1634,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1622
1634
|
}
|
|
1623
1635
|
|
|
1624
1636
|
_onEnded() {
|
|
1637
|
+
this._cancelAudioDescription();
|
|
1625
1638
|
this._playRequested = false;
|
|
1626
1639
|
this.dispatchEvent(new CustomEvent('ended'));
|
|
1627
1640
|
}
|
|
@@ -1684,6 +1697,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1684
1697
|
}
|
|
1685
1698
|
|
|
1686
1699
|
_onPause() {
|
|
1700
|
+
if (!this._audioDescriptionPausedVideo) this._cancelAudioDescription();
|
|
1687
1701
|
this._playing = false;
|
|
1688
1702
|
this.dispatchEvent(new CustomEvent('pause'));
|
|
1689
1703
|
}
|
|
@@ -1786,6 +1800,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1786
1800
|
|
|
1787
1801
|
async _onSlotChange(e) {
|
|
1788
1802
|
this._tracks = [];
|
|
1803
|
+
this._audioDescriptionTracks = [];
|
|
1789
1804
|
const nodes = e.target.assignedNodes();
|
|
1790
1805
|
let defaultTrack;
|
|
1791
1806
|
|
|
@@ -1813,6 +1828,11 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1813
1828
|
|
|
1814
1829
|
if (node.nodeType !== Node.ELEMENT_NODE || node.nodeName !== 'TRACK') continue;
|
|
1815
1830
|
|
|
1831
|
+
if (node.getAttribute('kind') === AUDIO_DESCRIPTION_TRACK_KIND) {
|
|
1832
|
+
await this._loadAudioDescriptionTrack(node);
|
|
1833
|
+
continue;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1816
1836
|
if (!(node.kind in TRACK_KINDS)) {
|
|
1817
1837
|
console.warn(`d2l-labs-media-player component requires 'kind' text on track to be one of ${Object.keys(TRACK_KINDS)}`);
|
|
1818
1838
|
continue;
|
|
@@ -1871,6 +1891,8 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1871
1891
|
}
|
|
1872
1892
|
}
|
|
1873
1893
|
|
|
1894
|
+
this._restoreAudioDescriptionPreference();
|
|
1895
|
+
|
|
1874
1896
|
await new Promise(resolve => {
|
|
1875
1897
|
const interval = setInterval(() => {
|
|
1876
1898
|
if (!this._media) return;
|
|
@@ -1947,7 +1969,8 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
1947
1969
|
return () => this.currentTime = time;
|
|
1948
1970
|
}
|
|
1949
1971
|
|
|
1950
|
-
_onTimeUpdate() {
|
|
1972
|
+
_onTimeUpdate(e) {
|
|
1973
|
+
this._onAudioDescriptionTimeUpdate(e.target.currentTime);
|
|
1951
1974
|
this.dispatchEvent(new CustomEvent('timeupdate'));
|
|
1952
1975
|
}
|
|
1953
1976
|
|
|
@@ -2044,6 +2067,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
2044
2067
|
}
|
|
2045
2068
|
|
|
2046
2069
|
_reloadSource() {
|
|
2070
|
+
this._cancelAudioDescription();
|
|
2047
2071
|
if (this._media) {
|
|
2048
2072
|
const oldSourceNode = this._media.getElementsByTagName('source')[0];
|
|
2049
2073
|
const updatedSource = this._getCurrentSource();
|
|
@@ -2089,7 +2113,7 @@ class MediaPlayer extends LocalizeLabsElement(RtlMixin(LitElement)) {
|
|
|
2089
2113
|
if (!this._media) {
|
|
2090
2114
|
return;
|
|
2091
2115
|
}
|
|
2092
|
-
const captionsMenu = this.shadowRoot.getElementById('
|
|
2116
|
+
const captionsMenu = this.shadowRoot.getElementById('captions-menu');
|
|
2093
2117
|
if (captionsMenu) {
|
|
2094
2118
|
this._captionsMenuReturnItem = captionsMenu.shadowRoot.querySelector('d2l-menu-item-return');
|
|
2095
2119
|
this._captionsMenuReturnItem?.setAttribute('text', this.localize('components:mediaPlayer:language'));
|