shaka-player 4.8.10 → 4.9.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/README.md +5 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +5 -5
- package/dist/locales.js +34 -34
- package/dist/shaka-player.compiled.d.ts +39 -18
- package/dist/shaka-player.compiled.debug.d.ts +39 -18
- package/dist/shaka-player.compiled.debug.externs.js +32 -12
- package/dist/shaka-player.compiled.debug.js +638 -579
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +32 -12
- package/dist/shaka-player.compiled.js +1272 -1237
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +39 -18
- package/dist/shaka-player.ui.debug.d.ts +39 -18
- package/dist/shaka-player.ui.debug.externs.js +43 -23
- package/dist/shaka-player.ui.debug.js +668 -609
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +43 -23
- package/dist/shaka-player.ui.js +1487 -1451
- package/dist/shaka-player.ui.map +4 -4
- package/externs/shaka/manifest.js +11 -1
- package/externs/shaka/offline.js +3 -0
- package/externs/shaka/player.js +105 -12
- package/externs/tizen.js +1 -1
- package/lib/abr/simple_abr_manager.js +5 -0
- package/lib/ads/media_tailor_ad.js +11 -0
- package/lib/ads/media_tailor_ad_manager.js +37 -3
- package/lib/dash/dash_parser.js +655 -46
- package/lib/dash/mpd_utils.js +7 -8
- package/lib/dash/segment_template.js +65 -10
- package/lib/hls/hls_parser.js +92 -34
- package/lib/media/content_workarounds.js +4 -2
- package/lib/media/drm_engine.js +274 -40
- package/lib/media/manifest_filterer.js +2 -2
- package/lib/media/media_source_engine.js +66 -31
- package/lib/media/segment_utils.js +14 -3
- package/lib/mss/mss_parser.js +2 -0
- package/lib/net/http_plugin_utils.js +2 -1
- package/lib/net/networking_engine.js +14 -0
- package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
- package/lib/offline/manifest_converter.js +2 -0
- package/lib/offline/storage.js +1 -0
- package/lib/player.js +220 -14
- package/lib/polyfill/media_capabilities.js +10 -35
- package/lib/transmuxer/aac_transmuxer.js +4 -2
- package/lib/transmuxer/ac3_transmuxer.js +2 -1
- package/lib/transmuxer/ec3_transmuxer.js +2 -1
- package/lib/transmuxer/mp3_transmuxer.js +4 -2
- package/lib/transmuxer/mpeg_ts_transmuxer.js +2 -1
- package/lib/transmuxer/mss_transmuxer.js +4 -2
- package/lib/transmuxer/ts_transmuxer.js +44 -24
- package/lib/util/config_utils.js +74 -6
- package/lib/util/error.js +17 -8
- package/lib/util/mp4_box_parsers.js +23 -2
- package/lib/util/periods.js +51 -28
- package/lib/util/platform.js +3 -1
- package/lib/util/player_configuration.js +20 -8
- package/lib/util/stream_utils.js +62 -30
- package/lib/util/tXml.js +74 -6
- package/package.json +2 -2
- package/support.html +1 -0
- package/ui/controls.js +4 -0
- package/ui/less/ad_controls.less +2 -1
- package/ui/resolution_selection.js +12 -3
|
@@ -144,7 +144,8 @@ shaka.transmuxer.Ec3Transmuxer = class {
|
|
|
144
144
|
return Promise.reject(new shaka.util.Error(
|
|
145
145
|
shaka.util.Error.Severity.CRITICAL,
|
|
146
146
|
shaka.util.Error.Category.MEDIA,
|
|
147
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
147
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
148
|
+
reference ? reference.getUris()[0] : null));
|
|
148
149
|
}
|
|
149
150
|
stream.audioSamplingRate = frame.sampleRate;
|
|
150
151
|
stream.channelsCount = frame.channelCount;
|
|
@@ -128,7 +128,8 @@ shaka.transmuxer.Mp3Transmuxer = class {
|
|
|
128
128
|
return Promise.reject(new shaka.util.Error(
|
|
129
129
|
shaka.util.Error.Severity.CRITICAL,
|
|
130
130
|
shaka.util.Error.Category.MEDIA,
|
|
131
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
131
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
132
|
+
reference ? reference.getUris()[0] : null));
|
|
132
133
|
}
|
|
133
134
|
if (!firstHeader) {
|
|
134
135
|
firstHeader = header;
|
|
@@ -155,7 +156,8 @@ shaka.transmuxer.Mp3Transmuxer = class {
|
|
|
155
156
|
return Promise.reject(new shaka.util.Error(
|
|
156
157
|
shaka.util.Error.Severity.CRITICAL,
|
|
157
158
|
shaka.util.Error.Category.MEDIA,
|
|
158
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
159
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
160
|
+
reference ? reference.getUris()[0] : null));
|
|
159
161
|
}
|
|
160
162
|
/** @type {number} */
|
|
161
163
|
const sampleRate = firstHeader.sampleRate;
|
|
@@ -147,7 +147,8 @@ shaka.transmuxer.MpegTsTransmuxer = class {
|
|
|
147
147
|
return Promise.reject(new shaka.util.Error(
|
|
148
148
|
shaka.util.Error.Severity.CRITICAL,
|
|
149
149
|
shaka.util.Error.Category.MEDIA,
|
|
150
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
150
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
151
|
+
reference ? reference.getUris()[0] : null));
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
let transmuxData = new Uint8Array([]);
|
|
@@ -226,7 +226,8 @@ shaka.transmuxer.MssTransmuxer = class {
|
|
|
226
226
|
return Promise.reject(new shaka.util.Error(
|
|
227
227
|
shaka.util.Error.Severity.CRITICAL,
|
|
228
228
|
shaka.util.Error.Category.MEDIA,
|
|
229
|
-
shaka.util.Error.Code.MSS_MISSING_DATA_FOR_TRANSMUXING
|
|
229
|
+
shaka.util.Error.Code.MSS_MISSING_DATA_FOR_TRANSMUXING,
|
|
230
|
+
reference ? reference.getUris()[0] : null));
|
|
230
231
|
}
|
|
231
232
|
try {
|
|
232
233
|
const transmuxedData = this.processMediaSegment_(
|
|
@@ -239,7 +240,8 @@ shaka.transmuxer.MssTransmuxer = class {
|
|
|
239
240
|
return Promise.reject(new shaka.util.Error(
|
|
240
241
|
shaka.util.Error.Severity.CRITICAL,
|
|
241
242
|
shaka.util.Error.Category.MEDIA,
|
|
242
|
-
shaka.util.Error.Code.MSS_TRANSMUXING_FAILED
|
|
243
|
+
shaka.util.Error.Code.MSS_TRANSMUXING_FAILED,
|
|
244
|
+
reference ? reference.getUris()[0] : null));
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
247
|
|
|
@@ -192,7 +192,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
192
192
|
return Promise.reject(new shaka.util.Error(
|
|
193
193
|
shaka.util.Error.Severity.CRITICAL,
|
|
194
194
|
shaka.util.Error.Category.MEDIA,
|
|
195
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
195
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
196
|
+
reference ? reference.getUris()[0] : null));
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
offset = id3Data.length;
|
|
@@ -209,7 +210,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
209
210
|
return Promise.reject(new shaka.util.Error(
|
|
210
211
|
shaka.util.Error.Severity.CRITICAL,
|
|
211
212
|
shaka.util.Error.Category.MEDIA,
|
|
212
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
213
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
214
|
+
reference ? reference.getUris()[0] : null));
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
if (!this.tsParser_) {
|
|
@@ -247,19 +249,19 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
247
249
|
break;
|
|
248
250
|
case 'ac3':
|
|
249
251
|
streamInfo =
|
|
250
|
-
this.getAc3StreamInfo_(tsParser, stream, duration);
|
|
252
|
+
this.getAc3StreamInfo_(tsParser, stream, duration, reference);
|
|
251
253
|
break;
|
|
252
254
|
case 'ec3':
|
|
253
255
|
streamInfo =
|
|
254
|
-
this.getEc3StreamInfo_(tsParser, stream, duration);
|
|
256
|
+
this.getEc3StreamInfo_(tsParser, stream, duration, reference);
|
|
255
257
|
break;
|
|
256
258
|
case 'mp3':
|
|
257
259
|
streamInfo =
|
|
258
|
-
this.getMp3StreamInfo_(tsParser, stream, duration);
|
|
260
|
+
this.getMp3StreamInfo_(tsParser, stream, duration, reference);
|
|
259
261
|
break;
|
|
260
262
|
case 'opus':
|
|
261
263
|
streamInfo =
|
|
262
|
-
this.getOpusStreamInfo_(tsParser, stream, duration);
|
|
264
|
+
this.getOpusStreamInfo_(tsParser, stream, duration, reference);
|
|
263
265
|
break;
|
|
264
266
|
}
|
|
265
267
|
if (streamInfo) {
|
|
@@ -278,7 +280,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
278
280
|
return Promise.reject(new shaka.util.Error(
|
|
279
281
|
shaka.util.Error.Severity.CRITICAL,
|
|
280
282
|
shaka.util.Error.Category.MEDIA,
|
|
281
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
283
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
284
|
+
reference ? reference.getUris()[0] : null));
|
|
282
285
|
}
|
|
283
286
|
|
|
284
287
|
const mp4Generator = new shaka.util.Mp4Generator(streamInfos);
|
|
@@ -327,7 +330,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
327
330
|
throw new shaka.util.Error(
|
|
328
331
|
shaka.util.Error.Severity.CRITICAL,
|
|
329
332
|
shaka.util.Error.Category.MEDIA,
|
|
330
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
333
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
334
|
+
reference ? reference.getUris()[0] : null);
|
|
331
335
|
}
|
|
332
336
|
stream.audioSamplingRate = info.sampleRate;
|
|
333
337
|
stream.channelsCount = info.channelCount;
|
|
@@ -370,7 +374,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
370
374
|
throw new shaka.util.Error(
|
|
371
375
|
shaka.util.Error.Severity.CRITICAL,
|
|
372
376
|
shaka.util.Error.Category.MEDIA,
|
|
373
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
377
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
378
|
+
reference ? reference.getUris()[0] : null);
|
|
374
379
|
}
|
|
375
380
|
|
|
376
381
|
firstPts = reference.startTime * timescale;
|
|
@@ -382,7 +387,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
382
387
|
throw new shaka.util.Error(
|
|
383
388
|
shaka.util.Error.Severity.CRITICAL,
|
|
384
389
|
shaka.util.Error.Category.MEDIA,
|
|
385
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
390
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
391
|
+
reference ? reference.getUris()[0] : null);
|
|
386
392
|
}
|
|
387
393
|
info = {
|
|
388
394
|
sampleRate: stream.audioSamplingRate,
|
|
@@ -395,7 +401,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
395
401
|
throw new shaka.util.Error(
|
|
396
402
|
shaka.util.Error.Severity.CRITICAL,
|
|
397
403
|
shaka.util.Error.Category.MEDIA,
|
|
398
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
404
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
405
|
+
reference ? reference.getUris()[0] : null);
|
|
399
406
|
}
|
|
400
407
|
const segmentDuration =
|
|
401
408
|
(reference.endTime - reference.startTime) * timescale;
|
|
@@ -451,10 +458,11 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
451
458
|
* @param {shaka.util.TsParser} tsParser
|
|
452
459
|
* @param {shaka.extern.Stream} stream
|
|
453
460
|
* @param {number} duration
|
|
461
|
+
* @param {?shaka.media.SegmentReference} reference
|
|
454
462
|
* @return {shaka.util.Mp4Generator.StreamInfo}
|
|
455
463
|
* @private
|
|
456
464
|
*/
|
|
457
|
-
getAc3StreamInfo_(tsParser, stream, duration) {
|
|
465
|
+
getAc3StreamInfo_(tsParser, stream, duration, reference) {
|
|
458
466
|
const Ac3 = shaka.transmuxer.Ac3;
|
|
459
467
|
const timescale = shaka.util.TsParser.Timescale;
|
|
460
468
|
|
|
@@ -511,7 +519,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
511
519
|
throw new shaka.util.Error(
|
|
512
520
|
shaka.util.Error.Severity.CRITICAL,
|
|
513
521
|
shaka.util.Error.Category.MEDIA,
|
|
514
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
522
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
523
|
+
reference ? reference.getUris()[0] : null);
|
|
515
524
|
}
|
|
516
525
|
|
|
517
526
|
|
|
@@ -544,10 +553,11 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
544
553
|
* @param {shaka.util.TsParser} tsParser
|
|
545
554
|
* @param {shaka.extern.Stream} stream
|
|
546
555
|
* @param {number} duration
|
|
556
|
+
* @param {?shaka.media.SegmentReference} reference
|
|
547
557
|
* @return {shaka.util.Mp4Generator.StreamInfo}
|
|
548
558
|
* @private
|
|
549
559
|
*/
|
|
550
|
-
getEc3StreamInfo_(tsParser, stream, duration) {
|
|
560
|
+
getEc3StreamInfo_(tsParser, stream, duration, reference) {
|
|
551
561
|
const Ec3 = shaka.transmuxer.Ec3;
|
|
552
562
|
const timescale = shaka.util.TsParser.Timescale;
|
|
553
563
|
|
|
@@ -604,7 +614,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
604
614
|
throw new shaka.util.Error(
|
|
605
615
|
shaka.util.Error.Severity.CRITICAL,
|
|
606
616
|
shaka.util.Error.Category.MEDIA,
|
|
607
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
617
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
618
|
+
reference ? reference.getUris()[0] : null);
|
|
608
619
|
}
|
|
609
620
|
|
|
610
621
|
|
|
@@ -637,10 +648,11 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
637
648
|
* @param {shaka.util.TsParser} tsParser
|
|
638
649
|
* @param {shaka.extern.Stream} stream
|
|
639
650
|
* @param {number} duration
|
|
651
|
+
* @param {?shaka.media.SegmentReference} reference
|
|
640
652
|
* @return {shaka.util.Mp4Generator.StreamInfo}
|
|
641
653
|
* @private
|
|
642
654
|
*/
|
|
643
|
-
getMp3StreamInfo_(tsParser, stream, duration) {
|
|
655
|
+
getMp3StreamInfo_(tsParser, stream, duration, reference) {
|
|
644
656
|
const MpegAudio = shaka.transmuxer.MpegAudio;
|
|
645
657
|
const timescale = shaka.util.TsParser.Timescale;
|
|
646
658
|
|
|
@@ -692,7 +704,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
692
704
|
throw new shaka.util.Error(
|
|
693
705
|
shaka.util.Error.Severity.CRITICAL,
|
|
694
706
|
shaka.util.Error.Category.MEDIA,
|
|
695
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
707
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
708
|
+
reference ? reference.getUris()[0] : null);
|
|
696
709
|
}
|
|
697
710
|
/** @type {number} */
|
|
698
711
|
const sampleRate = firstHeader.sampleRate;
|
|
@@ -725,10 +738,11 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
725
738
|
* @param {shaka.util.TsParser} tsParser
|
|
726
739
|
* @param {shaka.extern.Stream} stream
|
|
727
740
|
* @param {number} duration
|
|
741
|
+
* @param {?shaka.media.SegmentReference} reference
|
|
728
742
|
* @return {shaka.util.Mp4Generator.StreamInfo}
|
|
729
743
|
* @private
|
|
730
744
|
*/
|
|
731
|
-
getOpusStreamInfo_(tsParser, stream, duration) {
|
|
745
|
+
getOpusStreamInfo_(tsParser, stream, duration, reference) {
|
|
732
746
|
const Opus = shaka.transmuxer.Opus;
|
|
733
747
|
const timescale = shaka.util.TsParser.Timescale;
|
|
734
748
|
|
|
@@ -744,7 +758,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
744
758
|
throw new shaka.util.Error(
|
|
745
759
|
shaka.util.Error.Severity.CRITICAL,
|
|
746
760
|
shaka.util.Error.Category.MEDIA,
|
|
747
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
761
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
762
|
+
reference ? reference.getUris()[0] : null);
|
|
748
763
|
}
|
|
749
764
|
|
|
750
765
|
/** @type {!Uint8Array} */
|
|
@@ -798,7 +813,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
798
813
|
throw new shaka.util.Error(
|
|
799
814
|
shaka.util.Error.Severity.CRITICAL,
|
|
800
815
|
shaka.util.Error.Category.MEDIA,
|
|
801
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
816
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
817
|
+
reference ? reference.getUris()[0] : null);
|
|
802
818
|
}
|
|
803
819
|
|
|
804
820
|
stream.audioSamplingRate = opusMetadata.sampleRate;
|
|
@@ -854,7 +870,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
854
870
|
throw new shaka.util.Error(
|
|
855
871
|
shaka.util.Error.Severity.CRITICAL,
|
|
856
872
|
shaka.util.Error.Category.MEDIA,
|
|
857
|
-
shaka.util.Error.Code.TRANSMUXING_NO_VIDEO_DATA
|
|
873
|
+
shaka.util.Error.Code.TRANSMUXING_NO_VIDEO_DATA,
|
|
874
|
+
reference ? reference.getUris()[0] : null);
|
|
858
875
|
}
|
|
859
876
|
for (let i = 0; i < videoData.length; i++) {
|
|
860
877
|
const pes = videoData[i];
|
|
@@ -897,7 +914,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
897
914
|
throw new shaka.util.Error(
|
|
898
915
|
shaka.util.Error.Severity.CRITICAL,
|
|
899
916
|
shaka.util.Error.Category.MEDIA,
|
|
900
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
917
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
918
|
+
reference ? reference.getUris()[0] : null);
|
|
901
919
|
}
|
|
902
920
|
stream.height = info.height;
|
|
903
921
|
stream.width = info.width;
|
|
@@ -948,7 +966,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
948
966
|
throw new shaka.util.Error(
|
|
949
967
|
shaka.util.Error.Severity.CRITICAL,
|
|
950
968
|
shaka.util.Error.Category.MEDIA,
|
|
951
|
-
shaka.util.Error.Code.TRANSMUXING_NO_VIDEO_DATA
|
|
969
|
+
shaka.util.Error.Code.TRANSMUXING_NO_VIDEO_DATA,
|
|
970
|
+
reference ? reference.getUris()[0] : null);
|
|
952
971
|
}
|
|
953
972
|
for (let i = 0; i < videoData.length; i++) {
|
|
954
973
|
const pes = videoData[i];
|
|
@@ -991,7 +1010,8 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
991
1010
|
throw new shaka.util.Error(
|
|
992
1011
|
shaka.util.Error.Severity.CRITICAL,
|
|
993
1012
|
shaka.util.Error.Category.MEDIA,
|
|
994
|
-
shaka.util.Error.Code.TRANSMUXING_FAILED
|
|
1013
|
+
shaka.util.Error.Code.TRANSMUXING_FAILED,
|
|
1014
|
+
reference ? reference.getUris()[0] : null);
|
|
995
1015
|
}
|
|
996
1016
|
stream.height = info.height;
|
|
997
1017
|
stream.width = info.width;
|
package/lib/util/config_utils.js
CHANGED
|
@@ -28,17 +28,28 @@ shaka.util.ConfigUtils = class {
|
|
|
28
28
|
static mergeConfigObjects(destination, source, template, overrides, path) {
|
|
29
29
|
goog.asserts.assert(destination, 'Destination config must not be null!');
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
// If true, override the template.
|
|
32
|
+
const overrideTemplate = path in overrides;
|
|
33
|
+
|
|
34
|
+
// If true, treat the source as a generic object to be copied without
|
|
35
|
+
// descending more deeply.
|
|
36
|
+
let genericObject = false;
|
|
37
|
+
if (overrideTemplate) {
|
|
38
|
+
genericObject = template.constructor == Object &&
|
|
39
|
+
Object.keys(overrides).length == 0;
|
|
40
|
+
} else {
|
|
41
|
+
genericObject = template.constructor == Object &&
|
|
42
|
+
Object.keys(template).length == 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// If true, don't validate the keys in the next level.
|
|
46
|
+
const ignoreKeys = overrideTemplate || genericObject;
|
|
36
47
|
|
|
37
48
|
let isValid = true;
|
|
38
49
|
|
|
39
50
|
for (const k in source) {
|
|
40
51
|
const subPath = path + '.' + k;
|
|
41
|
-
const subTemplate =
|
|
52
|
+
const subTemplate = overrideTemplate ? overrides[path] : template[k];
|
|
42
53
|
|
|
43
54
|
// The order of these checks is important.
|
|
44
55
|
if (!ignoreKeys && !(k in template)) {
|
|
@@ -55,6 +66,10 @@ shaka.util.ConfigUtils = class {
|
|
|
55
66
|
// There is something in the template, so go back to that.
|
|
56
67
|
destination[k] = shaka.util.ObjectUtils.cloneObject(subTemplate);
|
|
57
68
|
}
|
|
69
|
+
} else if (genericObject) {
|
|
70
|
+
// Copy the fields of a generic object directly without a template and
|
|
71
|
+
// without descending any deeper.
|
|
72
|
+
destination[k] = source[k];
|
|
58
73
|
} else if (subTemplate.constructor == Object &&
|
|
59
74
|
source[k] &&
|
|
60
75
|
source[k].constructor == Object) {
|
|
@@ -152,4 +167,57 @@ shaka.util.ConfigUtils = class {
|
|
|
152
167
|
static referenceParametersAndReturn(parameters, returnValue) {
|
|
153
168
|
return parameters && returnValue;
|
|
154
169
|
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @param {!Object} object
|
|
173
|
+
* @param {!Object} base
|
|
174
|
+
* @return {!Object}
|
|
175
|
+
* @export
|
|
176
|
+
*/
|
|
177
|
+
static getDifferenceFromConfigObjects(object, base) {
|
|
178
|
+
const isObject = (obj) => {
|
|
179
|
+
return obj && typeof obj === 'object' && !Array.isArray(obj);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const isArrayEmpty = (array) => {
|
|
183
|
+
return Array.isArray(array) && array.length === 0;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const changes = (object, base) => {
|
|
187
|
+
return Object.keys(object).reduce((acc, key) => {
|
|
188
|
+
const value = object[key];
|
|
189
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
190
|
+
if (!base.hasOwnProperty(key)) {
|
|
191
|
+
acc[key] = value;
|
|
192
|
+
} else if (isObject(value) && isObject(base[key])) {
|
|
193
|
+
const diff = changes(value, base[key]);
|
|
194
|
+
if (Object.keys(diff).length > 0 || !isObject(diff)) {
|
|
195
|
+
acc[key] = diff;
|
|
196
|
+
}
|
|
197
|
+
} else if (isArrayEmpty(value) && isArrayEmpty(base[key])) {
|
|
198
|
+
// Do nothing if both are empty arrays
|
|
199
|
+
} else if (value !== base[key]) {
|
|
200
|
+
acc[key] = value;
|
|
201
|
+
}
|
|
202
|
+
return acc;
|
|
203
|
+
}, {});
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const diff = changes(object, base);
|
|
207
|
+
|
|
208
|
+
const removeEmpty = (obj) => {
|
|
209
|
+
for (const key of Object.keys(obj)) {
|
|
210
|
+
if (isObject(obj[key]) && Object.keys(obj[key]).length === 0) {
|
|
211
|
+
delete obj[key];
|
|
212
|
+
} else if (isArrayEmpty(obj[key])) {
|
|
213
|
+
delete obj[key];
|
|
214
|
+
} else if (isObject(obj[key])) {
|
|
215
|
+
removeEmpty(obj[key]);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
removeEmpty(diff);
|
|
221
|
+
return diff;
|
|
222
|
+
}
|
|
155
223
|
};
|
package/lib/util/error.js
CHANGED
|
@@ -212,6 +212,8 @@ shaka.util.Error.Code = {
|
|
|
212
212
|
* <br> error.data[3] is the map of response headers.
|
|
213
213
|
* <br> error.data[4] is the NetworkingEngine.RequestType of the request,
|
|
214
214
|
* if one was provided.
|
|
215
|
+
* <br> error.data[5] is the final URI. This may be different if the initial
|
|
216
|
+
* URI (error.data[0]) issued a redirect.
|
|
215
217
|
*/
|
|
216
218
|
'BAD_HTTP_STATUS': 1001,
|
|
217
219
|
|
|
@@ -454,6 +456,7 @@ shaka.util.Error.Code = {
|
|
|
454
456
|
/**
|
|
455
457
|
* A MediaSource operation failed.
|
|
456
458
|
* <br> error.data[0] is a MediaError code from the video element.
|
|
459
|
+
* <br> error.data[1] is the segment URI that triggered the error, if any.
|
|
457
460
|
*/
|
|
458
461
|
'MEDIA_SOURCE_OPERATION_FAILED': 3014,
|
|
459
462
|
|
|
@@ -461,6 +464,7 @@ shaka.util.Error.Code = {
|
|
|
461
464
|
* A MediaSource operation threw an exception.
|
|
462
465
|
* <br> error.data[0] is the exception that was thrown.
|
|
463
466
|
* <br> error.data[1] is the error object from the video element.
|
|
467
|
+
* <br> error.data[2] is the segment URI that triggered the error, if any.
|
|
464
468
|
*/
|
|
465
469
|
'MEDIA_SOURCE_OPERATION_THREW': 3015,
|
|
466
470
|
|
|
@@ -483,37 +487,37 @@ shaka.util.Error.Code = {
|
|
|
483
487
|
'QUOTA_EXCEEDED_ERROR': 3017,
|
|
484
488
|
|
|
485
489
|
/**
|
|
486
|
-
*
|
|
490
|
+
* Transmuxing with our internal transmuxer failed.
|
|
491
|
+
* <br> error.data[0] is the segment URI that triggered the error, if any.
|
|
487
492
|
*/
|
|
488
493
|
'TRANSMUXING_FAILED': 3018,
|
|
489
494
|
|
|
490
495
|
/**
|
|
491
496
|
* Content transformations required by the platform could not be performed for
|
|
492
497
|
* some reason (unsupported container, etc.)
|
|
493
|
-
*
|
|
494
|
-
*
|
|
498
|
+
* <br> @see https://github.com/shaka-project/shaka-player/issues/2759
|
|
499
|
+
* <br> error.data[0] is the segment URI that triggered the error, if any.
|
|
495
500
|
*/
|
|
496
501
|
'CONTENT_TRANSFORMATION_FAILED': 3019,
|
|
497
502
|
|
|
498
503
|
/**
|
|
499
504
|
* Important data is missing to be able to do the transmuxing of MSS.
|
|
505
|
+
* <br> error.data[0] is the segment URI that triggered the error, if any.
|
|
500
506
|
*/
|
|
501
507
|
'MSS_MISSING_DATA_FOR_TRANSMUXING': 3020,
|
|
502
508
|
|
|
503
|
-
|
|
504
|
-
* MSS transmuing failed for unknown codec.
|
|
505
|
-
* <br> error.data[0] is a unknown codec.
|
|
506
|
-
*/
|
|
507
|
-
'MSS_TRANSMUXING_CODEC_UNKNOWN': 3021,
|
|
509
|
+
// RETIRED: 'MSS_TRANSMUXING_CODEC_UNKNOWN': 3021,
|
|
508
510
|
|
|
509
511
|
/**
|
|
510
512
|
* MSS transmuing failed for unknown reason.
|
|
513
|
+
* <br> error.data[0] is the segment URI that triggered the error, if any.
|
|
511
514
|
*/
|
|
512
515
|
'MSS_TRANSMUXING_FAILED': 3022,
|
|
513
516
|
|
|
514
517
|
/**
|
|
515
518
|
* An internal error which indicates that transmuxing operation has no video
|
|
516
519
|
* data. This should not be seen by applications.
|
|
520
|
+
* <br> error.data[0] is the segment URI that triggered the error, if any.
|
|
517
521
|
*/
|
|
518
522
|
'TRANSMUXING_NO_VIDEO_DATA': 3023,
|
|
519
523
|
|
|
@@ -770,6 +774,11 @@ shaka.util.Error.Code = {
|
|
|
770
774
|
*/
|
|
771
775
|
'DASH_UNSUPPORTED_AES_128': 4051,
|
|
772
776
|
|
|
777
|
+
/**
|
|
778
|
+
* Patch requested during an update did not match original manifest.
|
|
779
|
+
*/
|
|
780
|
+
'DASH_INVALID_PATCH': 4052,
|
|
781
|
+
|
|
773
782
|
|
|
774
783
|
// RETIRED: 'INCONSISTENT_BUFFER_STATE': 5000,
|
|
775
784
|
// RETIRED: 'INVALID_SEGMENT_INDEX': 5001,
|
|
@@ -555,6 +555,7 @@ shaka.util.Mp4BoxParsers = class {
|
|
|
555
555
|
* @return {!shaka.util.ParsedCOLRBox}
|
|
556
556
|
*/
|
|
557
557
|
static parseCOLR(reader) {
|
|
558
|
+
let colorGamut = null;
|
|
558
559
|
let videoRange = null;
|
|
559
560
|
const data = reader.readBytes(4);
|
|
560
561
|
let colorType = '';
|
|
@@ -563,7 +564,22 @@ shaka.util.Mp4BoxParsers = class {
|
|
|
563
564
|
colorType += String.fromCharCode(data[2]);
|
|
564
565
|
colorType += String.fromCharCode(data[3]);
|
|
565
566
|
if (colorType === 'nclx') {
|
|
566
|
-
reader.readUint16();
|
|
567
|
+
const colorPrimaries = reader.readUint16();
|
|
568
|
+
switch (colorPrimaries) {
|
|
569
|
+
case 1:
|
|
570
|
+
case 5:
|
|
571
|
+
case 6:
|
|
572
|
+
case 7:
|
|
573
|
+
colorGamut = 'srgb';
|
|
574
|
+
break;
|
|
575
|
+
case 9:
|
|
576
|
+
colorGamut = 'rec2020';
|
|
577
|
+
break;
|
|
578
|
+
case 11:
|
|
579
|
+
case 12:
|
|
580
|
+
colorGamut = 'p3';
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
567
583
|
const transferCharacteristics = reader.readUint16();
|
|
568
584
|
reader.readUint16(); // matrix_coefficients
|
|
569
585
|
switch (transferCharacteristics) {
|
|
@@ -582,7 +598,10 @@ shaka.util.Mp4BoxParsers = class {
|
|
|
582
598
|
break;
|
|
583
599
|
}
|
|
584
600
|
}
|
|
585
|
-
return {
|
|
601
|
+
return {
|
|
602
|
+
colorGamut,
|
|
603
|
+
videoRange,
|
|
604
|
+
};
|
|
586
605
|
}
|
|
587
606
|
|
|
588
607
|
/**
|
|
@@ -913,9 +932,11 @@ shaka.util.ParsedHFOVBox;
|
|
|
913
932
|
|
|
914
933
|
/**
|
|
915
934
|
* @typedef {{
|
|
935
|
+
* colorGamut: ?string,
|
|
916
936
|
* videoRange: ?string
|
|
917
937
|
* }}
|
|
918
938
|
*
|
|
939
|
+
* @property {?string} colorGamut
|
|
919
940
|
* @property {?string} videoRange
|
|
920
941
|
*
|
|
921
942
|
* @exportDoc
|