shaka-player 3.3.12 → 3.3.13
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/CHANGELOG.md +14 -0
- package/dist/deps.js +2 -2
- package/dist/locales.js +31 -31
- package/dist/shaka-player.compiled.d.ts +1 -1
- package/dist/shaka-player.compiled.debug.d.ts +1 -1
- package/dist/shaka-player.compiled.debug.externs.js +2 -1
- package/dist/shaka-player.compiled.debug.js +77 -75
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.externs.js +2 -1
- package/dist/shaka-player.compiled.js +582 -579
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.d.ts +1 -1
- package/dist/shaka-player.ui.debug.d.ts +1 -1
- package/dist/shaka-player.ui.debug.externs.js +2 -1
- package/dist/shaka-player.ui.debug.js +95 -93
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.externs.js +2 -1
- package/dist/shaka-player.ui.js +676 -673
- package/dist/shaka-player.ui.map +3 -3
- package/lib/cast/cast_proxy.js +2 -1
- package/lib/cast/cast_receiver.js +19 -5
- package/lib/cast/cast_sender.js +2 -1
- package/lib/cast/cast_utils.js +16 -6
- package/lib/hls/hls_parser.js +9 -2
- package/lib/media/playhead.js +23 -1
- package/lib/media/streaming_engine.js +3 -12
- package/lib/player.js +24 -11
- package/lib/util/manifest_parser_utils.js +4 -0
- package/package.json +1 -1
- package/test/cast/cast_receiver_integration.js +97 -16
- package/test/cast/cast_receiver_unit.js +17 -12
- package/test/cast/cast_utils_unit.js +1 -0
- package/test/media/playhead_unit.js +41 -0
- package/test/media/streaming_engine_integration.js +13 -0
- package/test/media/streaming_engine_unit.js +23 -8
- package/test/player_unit.js +87 -0
- package/test/test/util/simple_fakes.js +3 -0
- package/ui/controls.js +4 -1
- package/ui/settings_menu.js +11 -2
|
@@ -171,6 +171,8 @@ describe('Playhead', () => {
|
|
|
171
171
|
Util.spyFunc(onSeek),
|
|
172
172
|
Util.spyFunc(onEvent));
|
|
173
173
|
|
|
174
|
+
playhead.ready();
|
|
175
|
+
|
|
174
176
|
expect(video.currentTime).toBe(5);
|
|
175
177
|
expect(playhead.getTime()).toBe(5);
|
|
176
178
|
|
|
@@ -192,6 +194,8 @@ describe('Playhead', () => {
|
|
|
192
194
|
Util.spyFunc(onSeek),
|
|
193
195
|
Util.spyFunc(onEvent));
|
|
194
196
|
|
|
197
|
+
playhead.ready();
|
|
198
|
+
|
|
195
199
|
expect(video.addEventListener).toHaveBeenCalledWith(
|
|
196
200
|
'loadedmetadata', jasmine.any(Function), jasmine.anything());
|
|
197
201
|
expect(video.addEventListener).not.toHaveBeenCalledWith(
|
|
@@ -233,6 +237,8 @@ describe('Playhead', () => {
|
|
|
233
237
|
Util.spyFunc(onSeek),
|
|
234
238
|
Util.spyFunc(onEvent));
|
|
235
239
|
|
|
240
|
+
playhead.ready();
|
|
241
|
+
|
|
236
242
|
video.on['seeking']();
|
|
237
243
|
expect(playhead.getTime()).toBe(5);
|
|
238
244
|
expect(video.currentTime).toBe(5);
|
|
@@ -266,6 +272,8 @@ describe('Playhead', () => {
|
|
|
266
272
|
video, manifest, config, /* startTime= */ 60, Util.spyFunc(onSeek),
|
|
267
273
|
Util.spyFunc(onEvent));
|
|
268
274
|
|
|
275
|
+
playhead.ready();
|
|
276
|
+
|
|
269
277
|
expect(playhead.getTime()).toBe(59); // duration - durationBackoff
|
|
270
278
|
expect(video.currentTime).toBe(59); // duration - durationBackoff
|
|
271
279
|
});
|
|
@@ -296,6 +304,8 @@ describe('Playhead', () => {
|
|
|
296
304
|
video, manifest, config, /* startTime= */ -40, Util.spyFunc(onSeek),
|
|
297
305
|
Util.spyFunc(onEvent));
|
|
298
306
|
|
|
307
|
+
playhead.ready();
|
|
308
|
+
|
|
299
309
|
expect(playhead.getTime()).toBe(30);
|
|
300
310
|
});
|
|
301
311
|
|
|
@@ -308,6 +318,8 @@ describe('Playhead', () => {
|
|
|
308
318
|
Util.spyFunc(onSeek),
|
|
309
319
|
Util.spyFunc(onEvent));
|
|
310
320
|
|
|
321
|
+
playhead.ready();
|
|
322
|
+
|
|
311
323
|
expect(video.addEventListener).toHaveBeenCalledWith(
|
|
312
324
|
'loadedmetadata', jasmine.any(Function), jasmine.anything());
|
|
313
325
|
|
|
@@ -341,6 +353,8 @@ describe('Playhead', () => {
|
|
|
341
353
|
Util.spyFunc(onSeek),
|
|
342
354
|
Util.spyFunc(onEvent));
|
|
343
355
|
|
|
356
|
+
playhead.ready();
|
|
357
|
+
|
|
344
358
|
expect(video.addEventListener).toHaveBeenCalledWith(
|
|
345
359
|
'loadedmetadata', jasmine.any(Function), jasmine.anything());
|
|
346
360
|
|
|
@@ -374,6 +388,8 @@ describe('Playhead', () => {
|
|
|
374
388
|
Util.spyFunc(onSeek),
|
|
375
389
|
Util.spyFunc(onEvent));
|
|
376
390
|
|
|
391
|
+
playhead.ready();
|
|
392
|
+
|
|
377
393
|
// This has to periodically increment the mock date to allow the onSeeking_
|
|
378
394
|
// handler to seek, if appropriate.
|
|
379
395
|
|
|
@@ -646,6 +662,8 @@ describe('Playhead', () => {
|
|
|
646
662
|
expect(currentTime).toBe(1000);
|
|
647
663
|
seekCount = 0;
|
|
648
664
|
|
|
665
|
+
playhead.ready();
|
|
666
|
+
|
|
649
667
|
// The availability window slips ahead.
|
|
650
668
|
timeline.getSeekRangeStart.and.returnValue(1030);
|
|
651
669
|
timeline.getSeekRangeEnd.and.returnValue(1030);
|
|
@@ -690,6 +708,8 @@ describe('Playhead', () => {
|
|
|
690
708
|
Util.spyFunc(onSeek),
|
|
691
709
|
Util.spyFunc(onEvent));
|
|
692
710
|
|
|
711
|
+
playhead.ready();
|
|
712
|
+
|
|
693
713
|
video.on['seeking']();
|
|
694
714
|
expect(video.currentTime).toBe(5);
|
|
695
715
|
expect(playhead.getTime()).toBe(5);
|
|
@@ -722,6 +742,8 @@ describe('Playhead', () => {
|
|
|
722
742
|
Util.spyFunc(onSeek),
|
|
723
743
|
Util.spyFunc(onEvent));
|
|
724
744
|
|
|
745
|
+
playhead.ready();
|
|
746
|
+
|
|
725
747
|
video.on['seeking']();
|
|
726
748
|
expect(video.currentTime).toBe(5);
|
|
727
749
|
expect(playhead.getTime()).toBe(5);
|
|
@@ -759,6 +781,9 @@ describe('Playhead', () => {
|
|
|
759
781
|
|
|
760
782
|
video.currentTime = 0;
|
|
761
783
|
video.seeking = true;
|
|
784
|
+
|
|
785
|
+
playhead.ready();
|
|
786
|
+
|
|
762
787
|
// "video.seeking" stays true until the buffered range intersects with
|
|
763
788
|
// "video.currentTime". Playhead should correct anyway.
|
|
764
789
|
video.on['seeking']();
|
|
@@ -803,6 +828,8 @@ describe('Playhead', () => {
|
|
|
803
828
|
Util.spyFunc(onSeek),
|
|
804
829
|
Util.spyFunc(onEvent));
|
|
805
830
|
|
|
831
|
+
playhead.ready();
|
|
832
|
+
|
|
806
833
|
/**
|
|
807
834
|
* Prevent retries on the initial start time seek. This will ensure that
|
|
808
835
|
* only one call is made for the initial seek, and that any additional calls
|
|
@@ -955,6 +982,8 @@ describe('Playhead', () => {
|
|
|
955
982
|
Util.spyFunc(onSeek),
|
|
956
983
|
Util.spyFunc(onEvent));
|
|
957
984
|
|
|
985
|
+
playhead.ready();
|
|
986
|
+
|
|
958
987
|
jasmine.clock().tick(500);
|
|
959
988
|
for (let time = data.start; time < data.waitingAt; time++) {
|
|
960
989
|
// We don't want to run tick() for 1 second because it will trigger
|
|
@@ -1208,6 +1237,8 @@ describe('Playhead', () => {
|
|
|
1208
1237
|
Util.spyFunc(onSeek),
|
|
1209
1238
|
Util.spyFunc(onEvent));
|
|
1210
1239
|
|
|
1240
|
+
playhead.ready();
|
|
1241
|
+
|
|
1211
1242
|
jasmine.clock().tick(500);
|
|
1212
1243
|
expect(onEvent).not.toHaveBeenCalled();
|
|
1213
1244
|
|
|
@@ -1257,6 +1288,8 @@ describe('Playhead', () => {
|
|
|
1257
1288
|
Util.spyFunc(onSeek),
|
|
1258
1289
|
Util.spyFunc(onEvent));
|
|
1259
1290
|
|
|
1291
|
+
playhead.ready();
|
|
1292
|
+
|
|
1260
1293
|
playhead.notifyOfBufferingChange();
|
|
1261
1294
|
jasmine.clock().tick(500);
|
|
1262
1295
|
|
|
@@ -1280,6 +1313,8 @@ describe('Playhead', () => {
|
|
|
1280
1313
|
Util.spyFunc(onSeek),
|
|
1281
1314
|
Util.spyFunc(onEvent));
|
|
1282
1315
|
|
|
1316
|
+
playhead.ready();
|
|
1317
|
+
|
|
1283
1318
|
playhead.notifyOfBufferingChange();
|
|
1284
1319
|
jasmine.clock().tick(500);
|
|
1285
1320
|
|
|
@@ -1305,6 +1340,8 @@ describe('Playhead', () => {
|
|
|
1305
1340
|
Util.spyFunc(onSeek),
|
|
1306
1341
|
Util.spyFunc(onEvent));
|
|
1307
1342
|
|
|
1343
|
+
playhead.ready();
|
|
1344
|
+
|
|
1308
1345
|
playhead.notifyOfBufferingChange();
|
|
1309
1346
|
jasmine.clock().tick(500);
|
|
1310
1347
|
|
|
@@ -1330,6 +1367,8 @@ describe('Playhead', () => {
|
|
|
1330
1367
|
Util.spyFunc(onSeek),
|
|
1331
1368
|
Util.spyFunc(onEvent));
|
|
1332
1369
|
|
|
1370
|
+
playhead.ready();
|
|
1371
|
+
|
|
1333
1372
|
playhead.notifyOfBufferingChange();
|
|
1334
1373
|
jasmine.clock().tick(500);
|
|
1335
1374
|
|
|
@@ -1362,6 +1401,8 @@ describe('Playhead', () => {
|
|
|
1362
1401
|
Util.spyFunc(onSeek),
|
|
1363
1402
|
Util.spyFunc(onEvent));
|
|
1364
1403
|
|
|
1404
|
+
playhead.ready();
|
|
1405
|
+
|
|
1365
1406
|
jasmine.clock().tick(500);
|
|
1366
1407
|
expect(onEvent).not.toHaveBeenCalled();
|
|
1367
1408
|
|
|
@@ -154,6 +154,19 @@ describe('StreamingEngine', () => {
|
|
|
154
154
|
/* presentationDuration= */ Infinity);
|
|
155
155
|
setupPlayhead();
|
|
156
156
|
|
|
157
|
+
// Retry on failure for live streams.
|
|
158
|
+
config.failureCallback = () => streamingEngine.retry(0.1);
|
|
159
|
+
|
|
160
|
+
// Ignore 404 errors in live stream tests.
|
|
161
|
+
onError.and.callFake((error) => {
|
|
162
|
+
if (error.code == shaka.util.Error.Code.BAD_HTTP_STATUS &&
|
|
163
|
+
error.data[1] == 404) {
|
|
164
|
+
// 404 error
|
|
165
|
+
} else {
|
|
166
|
+
fail(error);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
157
170
|
createStreamingEngine();
|
|
158
171
|
}
|
|
159
172
|
|
|
@@ -857,7 +857,7 @@ describe('StreamingEngine', () => {
|
|
|
857
857
|
|
|
858
858
|
const config = shaka.util.PlayerConfiguration.createDefault().streaming;
|
|
859
859
|
config.bufferingGoal = 60;
|
|
860
|
-
config.failureCallback = () => streamingEngine.retry();
|
|
860
|
+
config.failureCallback = () => streamingEngine.retry(0.1);
|
|
861
861
|
createStreamingEngine(config);
|
|
862
862
|
|
|
863
863
|
// Make requests for different types take different amounts of time.
|
|
@@ -1716,8 +1716,23 @@ describe('StreamingEngine', () => {
|
|
|
1716
1716
|
beforeEach(() => {
|
|
1717
1717
|
setupLive();
|
|
1718
1718
|
mediaSourceEngine = new shaka.test.FakeMediaSourceEngine(segmentData, 0);
|
|
1719
|
-
|
|
1719
|
+
|
|
1720
|
+
// Retry on failure for live streams.
|
|
1721
|
+
const config = shaka.util.PlayerConfiguration.createDefault().streaming;
|
|
1722
|
+
config.failureCallback = () => streamingEngine.retry(0.1);
|
|
1723
|
+
|
|
1724
|
+
createStreamingEngine(config);
|
|
1720
1725
|
presentationTimeInSeconds = 100;
|
|
1726
|
+
|
|
1727
|
+
// Ignore 404 errors in live stream tests.
|
|
1728
|
+
onError.and.callFake((error) => {
|
|
1729
|
+
if (error.code == shaka.util.Error.Code.BAD_HTTP_STATUS &&
|
|
1730
|
+
error.data[1] == 404) {
|
|
1731
|
+
// 404 error
|
|
1732
|
+
} else {
|
|
1733
|
+
fail(error);
|
|
1734
|
+
}
|
|
1735
|
+
});
|
|
1721
1736
|
});
|
|
1722
1737
|
|
|
1723
1738
|
it('outside segment availability window', async () => {
|
|
@@ -1753,9 +1768,9 @@ describe('StreamingEngine', () => {
|
|
|
1753
1768
|
if (startTime >= 100) {
|
|
1754
1769
|
// Ignore a possible call for the first Period.
|
|
1755
1770
|
expect(Util.invokeSpy(timeline.getSegmentAvailabilityStart))
|
|
1756
|
-
.
|
|
1771
|
+
.not.toBeLessThan(100);
|
|
1757
1772
|
expect(Util.invokeSpy(timeline.getSegmentAvailabilityEnd))
|
|
1758
|
-
.
|
|
1773
|
+
.not.toBeLessThan(120);
|
|
1759
1774
|
playing = true;
|
|
1760
1775
|
mediaSourceEngine.appendBuffer.and.callFake(
|
|
1761
1776
|
originalAppendBuffer);
|
|
@@ -1980,7 +1995,7 @@ describe('StreamingEngine', () => {
|
|
|
1980
1995
|
mediaSourceEngine = new shaka.test.FakeMediaSourceEngine(segmentData);
|
|
1981
1996
|
|
|
1982
1997
|
const config = shaka.util.PlayerConfiguration.createDefault().streaming;
|
|
1983
|
-
config.failureCallback = () => streamingEngine.retry();
|
|
1998
|
+
config.failureCallback = () => streamingEngine.retry(0.1);
|
|
1984
1999
|
createStreamingEngine(config);
|
|
1985
2000
|
|
|
1986
2001
|
presentationTimeInSeconds = 100;
|
|
@@ -2141,7 +2156,7 @@ describe('StreamingEngine', () => {
|
|
|
2141
2156
|
netEngine.request.calls.reset();
|
|
2142
2157
|
|
|
2143
2158
|
// Retry streaming.
|
|
2144
|
-
expect(streamingEngine.retry()).toBe(true);
|
|
2159
|
+
expect(streamingEngine.retry(0.1)).toBe(true);
|
|
2145
2160
|
});
|
|
2146
2161
|
|
|
2147
2162
|
// Here we go!
|
|
@@ -2171,7 +2186,7 @@ describe('StreamingEngine', () => {
|
|
|
2171
2186
|
|
|
2172
2187
|
// Retry streaming, which should fail and return false.
|
|
2173
2188
|
netEngine.request.calls.reset();
|
|
2174
|
-
expect(streamingEngine.retry()).toBe(false);
|
|
2189
|
+
expect(streamingEngine.retry(0.1)).toBe(false);
|
|
2175
2190
|
});
|
|
2176
2191
|
|
|
2177
2192
|
// Here we go!
|
|
@@ -2223,7 +2238,7 @@ describe('StreamingEngine', () => {
|
|
|
2223
2238
|
|
|
2224
2239
|
// Retry streaming, which should fail and return false.
|
|
2225
2240
|
netEngine.request.calls.reset();
|
|
2226
|
-
expect(streamingEngine.retry()).toBe(false);
|
|
2241
|
+
expect(streamingEngine.retry(0.1)).toBe(false);
|
|
2227
2242
|
}
|
|
2228
2243
|
});
|
|
2229
2244
|
|
package/test/player_unit.js
CHANGED
|
@@ -3735,6 +3735,93 @@ describe('Player', () => {
|
|
|
3735
3735
|
});
|
|
3736
3736
|
});
|
|
3737
3737
|
|
|
3738
|
+
describe('config streaming.failureCallback default', () => {
|
|
3739
|
+
/** @type {jasmine.Spy} */
|
|
3740
|
+
let retryStreaming;
|
|
3741
|
+
/** @type {jasmine.Spy} */
|
|
3742
|
+
let isLive;
|
|
3743
|
+
|
|
3744
|
+
/**
|
|
3745
|
+
* @suppress {accessControls}
|
|
3746
|
+
* @param {!shaka.util.Error} error
|
|
3747
|
+
*/
|
|
3748
|
+
function defaultStreamingFailureCallback(error) {
|
|
3749
|
+
player.defaultStreamingFailureCallback_(error);
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
beforeEach(() => {
|
|
3753
|
+
retryStreaming = jasmine.createSpy('retryStreaming');
|
|
3754
|
+
isLive = jasmine.createSpy('isLive');
|
|
3755
|
+
|
|
3756
|
+
player.retryStreaming = Util.spyFunc(retryStreaming);
|
|
3757
|
+
player.isLive = Util.spyFunc(isLive);
|
|
3758
|
+
});
|
|
3759
|
+
|
|
3760
|
+
it('ignores VOD failures', () => {
|
|
3761
|
+
isLive.and.returnValue(false);
|
|
3762
|
+
|
|
3763
|
+
const error = new shaka.util.Error(
|
|
3764
|
+
shaka.util.Error.Severity.CRITICAL,
|
|
3765
|
+
shaka.util.Error.Category.NETWORK,
|
|
3766
|
+
shaka.util.Error.Code.BAD_HTTP_STATUS,
|
|
3767
|
+
/* url= */ '',
|
|
3768
|
+
/* http_status= */ 404);
|
|
3769
|
+
|
|
3770
|
+
defaultStreamingFailureCallback(error);
|
|
3771
|
+
expect(retryStreaming).not.toHaveBeenCalled();
|
|
3772
|
+
});
|
|
3773
|
+
|
|
3774
|
+
it('retries live on HTTP 404', () => {
|
|
3775
|
+
isLive.and.returnValue(true);
|
|
3776
|
+
|
|
3777
|
+
const error = new shaka.util.Error(
|
|
3778
|
+
shaka.util.Error.Severity.CRITICAL,
|
|
3779
|
+
shaka.util.Error.Category.NETWORK,
|
|
3780
|
+
shaka.util.Error.Code.BAD_HTTP_STATUS,
|
|
3781
|
+
/* url= */ '',
|
|
3782
|
+
/* http_status= */ 404);
|
|
3783
|
+
|
|
3784
|
+
defaultStreamingFailureCallback(error);
|
|
3785
|
+
expect(retryStreaming).toHaveBeenCalled();
|
|
3786
|
+
});
|
|
3787
|
+
|
|
3788
|
+
it('retries live on generic HTTP error', () => {
|
|
3789
|
+
isLive.and.returnValue(true);
|
|
3790
|
+
|
|
3791
|
+
const error = new shaka.util.Error(
|
|
3792
|
+
shaka.util.Error.Severity.CRITICAL,
|
|
3793
|
+
shaka.util.Error.Category.NETWORK,
|
|
3794
|
+
shaka.util.Error.Code.HTTP_ERROR);
|
|
3795
|
+
|
|
3796
|
+
defaultStreamingFailureCallback(error);
|
|
3797
|
+
expect(retryStreaming).toHaveBeenCalled();
|
|
3798
|
+
});
|
|
3799
|
+
|
|
3800
|
+
it('retries live on HTTP timeout', () => {
|
|
3801
|
+
isLive.and.returnValue(true);
|
|
3802
|
+
|
|
3803
|
+
const error = new shaka.util.Error(
|
|
3804
|
+
shaka.util.Error.Severity.CRITICAL,
|
|
3805
|
+
shaka.util.Error.Category.NETWORK,
|
|
3806
|
+
shaka.util.Error.Code.TIMEOUT);
|
|
3807
|
+
|
|
3808
|
+
defaultStreamingFailureCallback(error);
|
|
3809
|
+
expect(retryStreaming).toHaveBeenCalled();
|
|
3810
|
+
});
|
|
3811
|
+
|
|
3812
|
+
it('ignores other live failures', () => {
|
|
3813
|
+
isLive.and.returnValue(true);
|
|
3814
|
+
|
|
3815
|
+
const error = new shaka.util.Error(
|
|
3816
|
+
shaka.util.Error.Severity.CRITICAL,
|
|
3817
|
+
shaka.util.Error.Category.MEDIA,
|
|
3818
|
+
shaka.util.Error.Code.VIDEO_ERROR);
|
|
3819
|
+
|
|
3820
|
+
defaultStreamingFailureCallback(error);
|
|
3821
|
+
expect(retryStreaming).not.toHaveBeenCalled();
|
|
3822
|
+
});
|
|
3823
|
+
});
|
|
3824
|
+
|
|
3738
3825
|
/**
|
|
3739
3826
|
* Gets the currently active variant track.
|
|
3740
3827
|
* @return {shaka.extern.Track}
|
|
@@ -333,6 +333,9 @@ shaka.test.FakePlayhead = class {
|
|
|
333
333
|
/** @private {number} */
|
|
334
334
|
this.startTime_ = 0;
|
|
335
335
|
|
|
336
|
+
/** @type {!jasmine.Spy} */
|
|
337
|
+
this.ready = jasmine.createSpy('ready');
|
|
338
|
+
|
|
336
339
|
/** @type {!jasmine.Spy} */
|
|
337
340
|
this.setStartTime = jasmine.createSpy('setStartTime')
|
|
338
341
|
.and.callFake((value) => {
|
package/ui/controls.js
CHANGED
|
@@ -1004,7 +1004,10 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
1004
1004
|
if (!this.video_ ||
|
|
1005
1005
|
this.video_.readyState == 0 ||
|
|
1006
1006
|
this.castProxy_.isCasting() ||
|
|
1007
|
-
!this.config_.enableFullscreenOnRotation
|
|
1007
|
+
!this.config_.enableFullscreenOnRotation ||
|
|
1008
|
+
!document.fullscreenEnabled) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1008
1011
|
|
|
1009
1012
|
if (screen.orientation.type.includes('landscape') &&
|
|
1010
1013
|
!document.fullscreenElement) {
|
package/ui/settings_menu.js
CHANGED
|
@@ -12,6 +12,7 @@ goog.require('shaka.ui.Enums');
|
|
|
12
12
|
goog.require('shaka.ui.Utils');
|
|
13
13
|
goog.require('shaka.util.Dom');
|
|
14
14
|
goog.require('shaka.util.FakeEvent');
|
|
15
|
+
goog.require('shaka.util.Iterables');
|
|
15
16
|
goog.requireType('shaka.ui.Controls');
|
|
16
17
|
|
|
17
18
|
|
|
@@ -116,8 +117,16 @@ shaka.ui.SettingsMenu = class extends shaka.ui.Element {
|
|
|
116
117
|
this.eventManager.listen(this.backButton, 'click', () => {
|
|
117
118
|
shaka.ui.Utils.setDisplay(this.parent, true);
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
(
|
|
120
|
+
const isDisplayed =
|
|
121
|
+
(element) => element.classList.contains('shaka-hidden') == false;
|
|
122
|
+
|
|
123
|
+
const Iterables = shaka.util.Iterables;
|
|
124
|
+
if (Iterables.some(this.parent.childNodes, isDisplayed)) {
|
|
125
|
+
// Focus on the first visible child of the overflow menu
|
|
126
|
+
const visibleElements =
|
|
127
|
+
Iterables.filter(this.parent.childNodes, isDisplayed);
|
|
128
|
+
/** @type {!HTMLElement} */ (visibleElements[0]).focus();
|
|
129
|
+
}
|
|
121
130
|
|
|
122
131
|
// Make sure controls are displayed
|
|
123
132
|
this.controls.computeOpacity();
|