shaka-player 3.3.0 → 3.3.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/CHANGELOG.md +54 -0
- package/build/conformance.textproto +183 -169
- package/dist/controls.css +1 -1
- package/dist/deps.js +1 -1
- package/dist/locales.js +30 -30
- package/dist/shaka-player.compiled.d.ts +25 -2
- package/dist/shaka-player.compiled.debug.d.ts +25 -2
- package/dist/shaka-player.compiled.debug.externs.js +22 -1
- package/dist/shaka-player.compiled.debug.js +226 -222
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.externs.js +22 -1
- package/dist/shaka-player.compiled.js +814 -812
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +25 -2
- package/dist/shaka-player.ui.debug.d.ts +25 -2
- package/dist/shaka-player.ui.debug.externs.js +22 -1
- package/dist/shaka-player.ui.debug.js +244 -240
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.externs.js +22 -1
- package/dist/shaka-player.ui.js +995 -992
- package/dist/shaka-player.ui.map +4 -4
- package/externs/cmcd.js +186 -0
- package/externs/shaka/player.js +8 -0
- package/externs/shaka/text.js +10 -0
- package/lib/hls/hls_parser.js +30 -0
- package/lib/media/segment_index.js +2 -1
- package/lib/media/segment_reference.js +19 -1
- package/lib/media/streaming_engine.js +5 -2
- package/lib/player.js +23 -17
- package/lib/polyfill/media_capabilities.js +30 -15
- package/lib/text/cue.js +6 -0
- package/lib/text/ttml_text_parser.js +84 -58
- package/lib/text/ui_text_displayer.js +17 -11
- package/lib/util/cmcd_manager.js +47 -201
- package/lib/util/stream_utils.js +86 -10
- package/lib/util/xml_utils.js +19 -0
- package/package.json +2 -2
- package/test/media/drm_engine_unit.js +3 -3
- package/test/media/streaming_engine_integration.js +2 -1
- package/test/media/streaming_engine_unit.js +145 -0
- package/test/player_integration.js +41 -8
- package/test/player_src_equals_integration.js +41 -8
- package/test/player_unit.js +19 -9
- package/test/test/assets/chapters.vtt +2 -2
- package/test/test/assets/chapters2.vtt +10 -0
- package/test/test/util/ttml_utils.js +81 -0
- package/test/text/mp4_ttml_parser_unit.js +11 -18
- package/test/text/ttml_text_parser_unit.js +499 -230
- package/test/util/cmcd_manager_unit.js +29 -15
- package/test/util/stream_utils_unit.js +36 -30
- package/third_party/closure-uri/uri.js +21 -0
- package/ui/text_selection.js +1 -0
- package/externs/media_capabilities.js +0 -16
|
@@ -33,13 +33,19 @@ describe('CmcdManager', () => {
|
|
|
33
33
|
describe('Query serialization', () => {
|
|
34
34
|
it('produces correctly serialized data', () => {
|
|
35
35
|
const query = CmcdManager.toQuery(data);
|
|
36
|
-
const result = '
|
|
37
|
-
'com.test-
|
|
38
|
-
'com.test-
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const result = 'br=52317,bs,cid="xyz",com.test-exists,' +
|
|
37
|
+
'com.test-hello="world",com.test-testing=1234,' +
|
|
38
|
+
'com.test-token=s,d=6067,mtp=10000,' +
|
|
39
|
+
'nor="..%2Ftesting%2F3.m4v",nrr="0-99",' +
|
|
40
|
+
'sid="c936730c-031e-4a73-976f-92bc34039c60"';
|
|
41
|
+
expect(query).toBe(result);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('escapes reserve character in string values', () => {
|
|
45
|
+
const query = CmcdManager.toQuery({
|
|
46
|
+
'com.test-escape': 'Double "Quotes"',
|
|
47
|
+
});
|
|
48
|
+
const result = 'com.test-escape="Double \\"Quotes\\""';
|
|
43
49
|
expect(query).toBe(result);
|
|
44
50
|
});
|
|
45
51
|
});
|
|
@@ -77,12 +83,20 @@ describe('CmcdManager', () => {
|
|
|
77
83
|
{start: 35, end: 40},
|
|
78
84
|
],
|
|
79
85
|
}),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
getVariantTracks: () => /** @type {Array.<shaka.extern.Track>} */([
|
|
87
|
+
{
|
|
88
|
+
type: 'variant',
|
|
89
|
+
bandwidth: 50000,
|
|
90
|
+
videoBandwidth: 40000,
|
|
91
|
+
audioBandWidth: 10000,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'variant',
|
|
95
|
+
bandwidth: 5000000,
|
|
96
|
+
videoBandwidth: 4000000,
|
|
97
|
+
audioBandWidth: 1000000,
|
|
98
|
+
},
|
|
99
|
+
]),
|
|
86
100
|
getPlaybackRate: () => 1,
|
|
87
101
|
getCurrentTime: () => 10,
|
|
88
102
|
};
|
|
@@ -169,7 +183,7 @@ describe('CmcdManager', () => {
|
|
|
169
183
|
const uri = 'https://test.com/test.mpd?CMCD=bl%3D21200%2Cbr%3D5234%2Ccid%3D%22' +
|
|
170
184
|
'testing%22%2Cd%3D3330%2Cmtp%3D10000%2Cot%3Dv%2Csf%3Dd%2C' +
|
|
171
185
|
'sid%3D%222ed2d1cd-970b-48f2-bfb3-50a79e87cfa3%22%2Cst%3Dv%2Csu%2C' +
|
|
172
|
-
'tb%
|
|
186
|
+
'tb%3D4000';
|
|
173
187
|
expect(r.uris[0]).toBe(uri);
|
|
174
188
|
});
|
|
175
189
|
|
|
@@ -206,7 +220,7 @@ describe('CmcdManager', () => {
|
|
|
206
220
|
cmcdManager.applySegmentData(r, segmentInfo);
|
|
207
221
|
expect(r.headers).toEqual({
|
|
208
222
|
'testing': '1234',
|
|
209
|
-
'CMCD-Object': 'br=5234,d=3330,ot=v,tb=
|
|
223
|
+
'CMCD-Object': 'br=5234,d=3330,ot=v,tb=4000',
|
|
210
224
|
'CMCD-Request': 'bl=21200,mtp=10000,su',
|
|
211
225
|
'CMCD-Session': 'cid="testing",sf=d,' +
|
|
212
226
|
'sid="2ed2d1cd-970b-48f2-bfb3-50a79e87cfa3",st=v',
|
|
@@ -16,14 +16,14 @@ describe('StreamUtils', () => {
|
|
|
16
16
|
/** @type {!jasmine.Spy} */
|
|
17
17
|
let decodingInfoSpy;
|
|
18
18
|
|
|
19
|
-
const originalDecodingInfo =
|
|
19
|
+
const originalDecodingInfo = navigator.mediaCapabilities.decodingInfo;
|
|
20
20
|
|
|
21
21
|
beforeEach(() => {
|
|
22
22
|
decodingInfoSpy = jasmine.createSpy('decodingInfo');
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
afterEach(() => {
|
|
26
|
-
|
|
26
|
+
navigator.mediaCapabilities.decodingInfo = originalDecodingInfo;
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
describe('filterStreamsByLanguageAndRole', () => {
|
|
@@ -511,7 +511,7 @@ describe('StreamUtils', () => {
|
|
|
511
511
|
});
|
|
512
512
|
|
|
513
513
|
it('handles decodingInfo exception', async () => {
|
|
514
|
-
|
|
514
|
+
navigator.mediaCapabilities.decodingInfo =
|
|
515
515
|
shaka.test.Util.spyFunc(decodingInfoSpy);
|
|
516
516
|
// If decodingInfo() fails, setDecodingInfo should finish without throwing
|
|
517
517
|
// an exception, and the variant should have no decodingInfo result.
|
|
@@ -539,38 +539,44 @@ describe('StreamUtils', () => {
|
|
|
539
539
|
});
|
|
540
540
|
|
|
541
541
|
it('includes transferFunction in config when hdr', async () => {
|
|
542
|
-
|
|
543
|
-
shaka.test.Util.spyFunc(decodingInfoSpy);
|
|
542
|
+
const originalDecodingInfo = navigator.mediaCapabilities.decodingInfo;
|
|
544
543
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
544
|
+
try {
|
|
545
|
+
navigator.mediaCapabilities.decodingInfo =
|
|
546
|
+
shaka.test.Util.spyFunc(decodingInfoSpy);
|
|
547
|
+
|
|
548
|
+
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
|
549
|
+
manifest.addVariant(0, (variant) => {
|
|
550
|
+
variant.addVideo(0, (stream) => {
|
|
551
|
+
stream.mime('video/mp4', 'avc1.640028');
|
|
552
|
+
stream.hdr = 'SDR';
|
|
553
|
+
});
|
|
550
554
|
});
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
555
|
+
manifest.addVariant(1, (variant) => {
|
|
556
|
+
variant.addVideo(1, (stream) => {
|
|
557
|
+
stream.mime('video/mp4', 'hvc1.2.4.L150.90');
|
|
558
|
+
stream.hdr = 'PQ';
|
|
559
|
+
});
|
|
556
560
|
});
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
561
|
+
manifest.addVariant(2, (variant) => {
|
|
562
|
+
variant.addVideo(2, (stream) => {
|
|
563
|
+
stream.mime('video/mp4', 'hvc1.2.4.L153.B0');
|
|
564
|
+
stream.hdr = 'HLG';
|
|
565
|
+
});
|
|
562
566
|
});
|
|
563
567
|
});
|
|
564
|
-
});
|
|
565
568
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
await StreamUtils.getDecodingInfosForVariants(manifest.variants,
|
|
570
|
+
/* usePersistentLicenses= */ false, /* srcEquals= */ false);
|
|
571
|
+
expect(decodingInfoSpy.calls.argsFor(0)[0].video.transferFunction)
|
|
572
|
+
.toBe('srgb');
|
|
573
|
+
expect(decodingInfoSpy.calls.argsFor(1)[0].video.transferFunction)
|
|
574
|
+
.toBe('pq');
|
|
575
|
+
expect(decodingInfoSpy.calls.argsFor(2)[0].video.transferFunction)
|
|
576
|
+
.toBe('hlg');
|
|
577
|
+
} finally {
|
|
578
|
+
navigator.mediaCapabilities.decodingInfo = originalDecodingInfo;
|
|
579
|
+
}
|
|
574
580
|
});
|
|
575
581
|
});
|
|
576
582
|
|
|
@@ -861,7 +867,7 @@ describe('StreamUtils', () => {
|
|
|
861
867
|
});
|
|
862
868
|
});
|
|
863
869
|
});
|
|
864
|
-
|
|
870
|
+
navigator.mediaCapabilities.decodingInfo =
|
|
865
871
|
shaka.test.Util.spyFunc(decodingInfoSpy);
|
|
866
872
|
decodingInfoSpy.and.callFake((config) => {
|
|
867
873
|
const res = config.video.contentType.includes('notsmooth') ?
|
|
@@ -808,6 +808,27 @@ goog.Uri.QueryData.prototype.add = function(key, value) {
|
|
|
808
808
|
return this;
|
|
809
809
|
};
|
|
810
810
|
|
|
811
|
+
/**
|
|
812
|
+
* Sets a key value pair and removes all other keys with the same value.
|
|
813
|
+
*
|
|
814
|
+
* @param {string} key Name.
|
|
815
|
+
* @param {string} value Value.
|
|
816
|
+
* @return {!goog.Uri.QueryData} Instance of this object.
|
|
817
|
+
*/
|
|
818
|
+
goog.Uri.QueryData.prototype.set = function(key, value) {
|
|
819
|
+
this.ensureKeyMapInitialized_();
|
|
820
|
+
// Invalidate the cache.
|
|
821
|
+
this.encodedQuery_ = null;
|
|
822
|
+
|
|
823
|
+
if (!this.keyMap_.hasOwnProperty(key)) {
|
|
824
|
+
this.add(key, value);
|
|
825
|
+
} else {
|
|
826
|
+
this.keyMap_[key] = [value];
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
return this;
|
|
830
|
+
};
|
|
831
|
+
|
|
811
832
|
|
|
812
833
|
/**
|
|
813
834
|
* @return {string} Encoded query string.
|
package/ui/text_selection.js
CHANGED
|
@@ -66,6 +66,7 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
66
66
|
|
|
67
67
|
this.eventManager.listen(this.player, 'texttrackvisibility', () => {
|
|
68
68
|
this.onCaptionStateChange_();
|
|
69
|
+
this.updateTextLanguages_();
|
|
69
70
|
});
|
|
70
71
|
|
|
71
72
|
this.eventManager.listen(this.player, 'textchanged', () => {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*! @license
|
|
2
|
-
* Shaka Player
|
|
3
|
-
* Copyright 2016 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview Externs for Shaka MediaCapabilities which were missing in the
|
|
9
|
-
* Closure compiler.
|
|
10
|
-
*
|
|
11
|
-
* @externs
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** @type {MediaCapabilities} */
|
|
16
|
-
window.shakaMediaCapabilities;
|