shaka-player 4.1.3 → 4.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.
- package/.github/workflows/selenium-lab-tests.yaml +158 -53
- package/CHANGELOG.md +11 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/locales.js +33 -33
- package/dist/shaka-player.compiled.debug.js +10 -9
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.js +36 -36
- package/dist/shaka-player.compiled.map +2 -2
- package/dist/shaka-player.ui.debug.js +13 -11
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.js +37 -37
- package/dist/shaka-player.ui.map +2 -2
- package/lib/player.js +13 -1
- package/lib/text/ui_text_displayer.js +8 -0
- package/lib/util/player_configuration.js +1 -0
- package/package.json +1 -1
- package/test/media/drm_engine_unit.js +29 -0
- package/test/player_src_equals_integration.js +2 -0
- package/test/player_unit.js +39 -1
- package/test/test/assets/small.mp4 +0 -0
- package/ui/less/ad_controls.less +4 -0
package/lib/player.js
CHANGED
|
@@ -4452,6 +4452,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4452
4452
|
this.stats_.setBandwidthEstimate(estimate);
|
|
4453
4453
|
}
|
|
4454
4454
|
|
|
4455
|
+
if (this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS) {
|
|
4456
|
+
this.stats_.setResolution(
|
|
4457
|
+
/* width= */ element.videoWidth || NaN,
|
|
4458
|
+
/* height= */ element.videoHeight || NaN);
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4455
4461
|
return this.stats_.getBlob();
|
|
4456
4462
|
}
|
|
4457
4463
|
|
|
@@ -5618,6 +5624,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5618
5624
|
return false;
|
|
5619
5625
|
}
|
|
5620
5626
|
|
|
5627
|
+
if (!navigator.onLine) {
|
|
5628
|
+
// Don't restrict variants if we're completely offline, or else we end up
|
|
5629
|
+
// rapidly restricting all of them.
|
|
5630
|
+
return false;
|
|
5631
|
+
}
|
|
5632
|
+
|
|
5621
5633
|
let maxDisabledTime = this.config_.streaming.maxDisabledTime;
|
|
5622
5634
|
if (maxDisabledTime == 0) {
|
|
5623
5635
|
if (error.code == shaka.util.Error.Code.SEGMENT_MISSING) {
|
|
@@ -6551,7 +6563,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
|
|
|
6551
6563
|
* @define {string} A version number taken from git at compile time.
|
|
6552
6564
|
* @export
|
|
6553
6565
|
*/
|
|
6554
|
-
shaka.Player.version = 'v4.1.
|
|
6566
|
+
shaka.Player.version = 'v4.1.4-uncompiled';
|
|
6555
6567
|
|
|
6556
6568
|
// Initialize the deprecation system using the version string we just set
|
|
6557
6569
|
// on the player.
|
|
@@ -493,6 +493,14 @@ shaka.text.UITextDisplayer = class {
|
|
|
493
493
|
style.backgroundRepeat = 'no-repeat';
|
|
494
494
|
style.backgroundSize = 'contain';
|
|
495
495
|
style.backgroundPosition = 'center';
|
|
496
|
+
|
|
497
|
+
// Quoting https://www.w3.org/TR/ttml-imsc1.2/:
|
|
498
|
+
// "The width and height (in pixels) of the image resource referenced by
|
|
499
|
+
// smpte:backgroundImage SHALL be equal to the width and height expressed
|
|
500
|
+
// by the tts:extent attribute of the region in which the div element is
|
|
501
|
+
// presented".
|
|
502
|
+
style.width = '100%';
|
|
503
|
+
style.height = '100%';
|
|
496
504
|
} else {
|
|
497
505
|
// If we have both text and nested cues, then style everything; otherwise
|
|
498
506
|
// place the text in its own <span> so the background doesn't fill the
|
package/package.json
CHANGED
|
@@ -677,6 +677,35 @@ describe('DrmEngine', () => {
|
|
|
677
677
|
.toBeRejectedWith(expected);
|
|
678
678
|
});
|
|
679
679
|
|
|
680
|
+
it('uses key system IDs from keySystemsMapping config', async () => {
|
|
681
|
+
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
|
682
|
+
manifest.addVariant(0, (variant) => {
|
|
683
|
+
variant.addVideo(1, (stream) => {
|
|
684
|
+
stream.encrypted = true;
|
|
685
|
+
stream.addDrmInfo('drm.abc');
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
setDecodingInfoSpy([]);
|
|
691
|
+
|
|
692
|
+
config.keySystemsMapping['drm.abc'] = 'drm.def';
|
|
693
|
+
drmEngine.configure(config);
|
|
694
|
+
|
|
695
|
+
const variants = manifest.variants;
|
|
696
|
+
await expectAsync(
|
|
697
|
+
drmEngine.initForPlayback(variants, manifest.offlineSessionIds))
|
|
698
|
+
.toBeRejected();
|
|
699
|
+
|
|
700
|
+
expect(drmEngine.initialized()).toBe(false);
|
|
701
|
+
expect(decodingInfoSpy).toHaveBeenCalledTimes(1);
|
|
702
|
+
expect(decodingInfoSpy).toHaveBeenCalledWith(containing({
|
|
703
|
+
keySystemConfiguration: containing({
|
|
704
|
+
keySystem: 'drm.def',
|
|
705
|
+
}),
|
|
706
|
+
}));
|
|
707
|
+
});
|
|
708
|
+
|
|
680
709
|
it('maps TS MIME types through the transmuxer', async () => {
|
|
681
710
|
const originalIsSupported = shaka.media.Transmuxer.isSupported;
|
|
682
711
|
|
|
@@ -305,6 +305,8 @@ describe('Player Src Equals', () => {
|
|
|
305
305
|
expect(stats.loadLatency).toBeGreaterThan(0);
|
|
306
306
|
expect(stats.manifestTimeSeconds).toBeNaN(); // There's no manifest.
|
|
307
307
|
expect(stats.drmTimeSeconds).toBeNaN(); // There's no DRM.
|
|
308
|
+
expect(stats.height).toBe(110);
|
|
309
|
+
expect(stats.width).toBe(256);
|
|
308
310
|
});
|
|
309
311
|
|
|
310
312
|
it('plays with external text tracks', async () => {
|
package/test/player_unit.js
CHANGED
|
@@ -422,7 +422,6 @@ describe('Player', () => {
|
|
|
422
422
|
dispatchEventSpy.calls.reset();
|
|
423
423
|
player.configure({streaming: {maxDisabledTime}});
|
|
424
424
|
player.setMaxHardwareResolution(123, 456);
|
|
425
|
-
onErrorCallback(httpError);
|
|
426
425
|
});
|
|
427
426
|
|
|
428
427
|
afterEach(() => {
|
|
@@ -434,14 +433,18 @@ describe('Player', () => {
|
|
|
434
433
|
});
|
|
435
434
|
|
|
436
435
|
it('handles HTTP_ERROR', () => {
|
|
436
|
+
onErrorCallback(httpError);
|
|
437
437
|
expect(httpError.handled).toBeTruthy();
|
|
438
438
|
});
|
|
439
439
|
|
|
440
440
|
it('does not dispatch any error', () => {
|
|
441
|
+
onErrorCallback(httpError);
|
|
441
442
|
expect(dispatchEventSpy).not.toHaveBeenCalled();
|
|
442
443
|
});
|
|
443
444
|
|
|
444
445
|
it('disables the current variant and applies restrictions', () => {
|
|
446
|
+
onErrorCallback(httpError);
|
|
447
|
+
|
|
445
448
|
const foundDisabledVariant =
|
|
446
449
|
manifest.variants.some(({disabledUntilTime}) =>
|
|
447
450
|
disabledUntilTime == currentTime + maxDisabledTime);
|
|
@@ -453,11 +456,46 @@ describe('Player', () => {
|
|
|
453
456
|
});
|
|
454
457
|
|
|
455
458
|
it('switches the variant', () => {
|
|
459
|
+
onErrorCallback(httpError);
|
|
460
|
+
|
|
456
461
|
expect(chooseVariantSpy).toHaveBeenCalled();
|
|
457
462
|
expect(getBufferedInfoSpy).toHaveBeenCalled();
|
|
458
463
|
expect(switchVariantSpy)
|
|
459
464
|
.toHaveBeenCalledWith(chosenVariant, false, true, 14);
|
|
460
465
|
});
|
|
466
|
+
|
|
467
|
+
describe('but browser is truly offline', () => {
|
|
468
|
+
/** @type {!Object} */
|
|
469
|
+
let navigatorOnLineDescriptor;
|
|
470
|
+
|
|
471
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
472
|
+
const navigatorPrototype = Navigator.prototype;
|
|
473
|
+
|
|
474
|
+
beforeAll(() => {
|
|
475
|
+
navigatorOnLineDescriptor =
|
|
476
|
+
/** @type {!Object} */(Object.getOwnPropertyDescriptor(
|
|
477
|
+
navigatorPrototype, 'onLine'));
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
beforeEach(() => {
|
|
481
|
+
// Redefine the property, replacing only the getter.
|
|
482
|
+
Object.defineProperty(navigatorPrototype, 'onLine',
|
|
483
|
+
Object.assign(navigatorOnLineDescriptor, {
|
|
484
|
+
get: () => false,
|
|
485
|
+
}));
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
afterEach(() => {
|
|
489
|
+
// Restore the original property definition.
|
|
490
|
+
Object.defineProperty(
|
|
491
|
+
navigatorPrototype, 'onLine', navigatorOnLineDescriptor);
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
it('does not handle HTTP_ERROR', () => {
|
|
495
|
+
onErrorCallback(httpError);
|
|
496
|
+
expect(httpError.handled).toBe(false);
|
|
497
|
+
});
|
|
498
|
+
});
|
|
461
499
|
});
|
|
462
500
|
});
|
|
463
501
|
});
|
|
Binary file
|
package/ui/less/ad_controls.less
CHANGED
|
@@ -71,6 +71,10 @@
|
|
|
71
71
|
.ad-text-shadow();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
.shaka-ad-controls .shaka-ad-position:not(.shaka-hidden) + .shaka-ad-counter {
|
|
75
|
+
margin-left: 0.75em;
|
|
76
|
+
}
|
|
77
|
+
|
|
74
78
|
.shaka-skip-ad-container {
|
|
75
79
|
/* Skip button is positioned at the very right edge of the
|
|
76
80
|
* video container unlike the rest of the bottom controls. */
|