shaka-player 4.10.13 → 4.11.0
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 -1
- package/dist/controls.css +3 -3
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +11 -11
- package/dist/locales.js +38 -34
- package/dist/shaka-player.compiled.d.ts +68 -33
- package/dist/shaka-player.compiled.debug.d.ts +68 -33
- package/dist/shaka-player.compiled.debug.externs.js +584 -544
- package/dist/shaka-player.compiled.debug.js +715 -676
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +584 -544
- package/dist/shaka-player.compiled.js +1394 -1371
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +76 -34
- package/dist/shaka-player.ui.debug.d.ts +76 -34
- package/dist/shaka-player.ui.debug.externs.js +77 -26
- package/dist/shaka-player.ui.debug.js +774 -720
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +77 -26
- package/dist/shaka-player.ui.js +1649 -1617
- package/dist/shaka-player.ui.map +4 -4
- package/externs/mediasession.js +10 -1
- package/externs/shaka/ads.js +79 -2
- package/externs/shaka/manifest.js +6 -1
- package/externs/shaka/manifest_parser.js +6 -2
- package/externs/shaka/net.js +23 -2
- package/externs/shaka/player.js +414 -103
- package/externs/shaka/text.js +2 -1
- package/lib/abr/simple_abr_manager.js +5 -0
- package/lib/ads/ad_manager.js +45 -1
- package/lib/ads/ad_utils.js +124 -1
- package/lib/ads/interstitial_ad.js +9 -2
- package/lib/ads/interstitial_ad_manager.js +216 -101
- package/lib/ads/media_tailor_ad.js +1 -39
- package/lib/ads/media_tailor_ad_manager.js +32 -16
- package/lib/cea/cea608_data_channel.js +40 -8
- package/lib/cea/cea608_memory.js +28 -0
- package/lib/dash/dash_parser.js +162 -25
- package/lib/dash/segment_base.js +3 -2
- package/lib/dash/segment_list.js +6 -3
- package/lib/dash/segment_template.js +104 -20
- package/lib/hls/hls_parser.js +319 -215
- package/lib/media/drm_engine.js +11 -3
- package/lib/media/media_source_engine.js +0 -8
- package/lib/media/preload_manager.js +16 -4
- package/lib/media/segment_reference.js +3 -0
- package/lib/media/segment_utils.js +8 -1
- package/lib/media/streaming_engine.js +10 -6
- package/lib/mss/mss_parser.js +14 -2
- package/lib/net/http_fetch_plugin.js +12 -5
- package/lib/net/http_xhr_plugin.js +7 -3
- package/lib/net/networking_engine.js +21 -1
- package/lib/offline/manifest_converter.js +1 -0
- package/lib/offline/storage.js +1 -0
- package/lib/player.js +336 -121
- package/lib/text/cue.js +373 -0
- package/lib/text/mp4_ttml_parser.js +51 -1
- package/lib/text/mp4_vtt_parser.js +2 -5
- package/lib/text/sbv_text_parser.js +2 -31
- package/lib/text/srt_text_parser.js +1 -1
- package/lib/text/text_engine.js +1 -1
- package/lib/text/text_utils.js +1 -0
- package/lib/text/ttml_text_parser.js +14 -4
- package/lib/text/ui_text_displayer.js +0 -4
- package/lib/text/vtt_text_parser.js +10 -415
- package/lib/util/abortable_operation.js +8 -0
- package/lib/util/cmcd_manager.js +38 -0
- package/lib/util/error.js +16 -0
- package/lib/util/fake_event.js +1 -0
- package/lib/util/manifest_parser_utils.js +12 -3
- package/lib/util/player_configuration.js +4 -2
- package/lib/util/stream_utils.js +57 -2
- package/lib/util/tXml.js +2 -1
- package/lib/util/text_parser.js +46 -0
- package/lib/util/ts_parser.js +32 -3
- package/package.json +1 -1
- package/shaka-player.uncompiled.js +1 -1
- package/ui/chapter_selection.js +179 -0
- package/ui/controls.js +151 -0
- package/ui/enums.js +1 -0
- package/ui/externs/ui.js +7 -1
- package/ui/less/containers.less +3 -4
- package/ui/less/overflow_menu.less +5 -0
- package/ui/less/tooltip.less +1 -1
- package/ui/locales/en.json +1 -0
- package/ui/locales/es.json +1 -0
- package/ui/locales/fr.json +1 -0
- package/ui/locales/source.json +4 -0
- package/ui/seek_bar.js +3 -2
- package/ui/ui.js +2 -0
- package/lib/polyfill/abort_controller.js +0 -158
|
@@ -96,7 +96,8 @@ shaka.dash.SegmentTemplate = class {
|
|
|
96
96
|
generateSegmentIndex: () => {
|
|
97
97
|
return SegmentTemplate.generateSegmentIndexFromDuration_(
|
|
98
98
|
shallowCopyOfContext, info, segmentLimit, initSegmentReference,
|
|
99
|
-
periodDurationMap, aesKey, lastSegmentNumber
|
|
99
|
+
periodDurationMap, aesKey, lastSegmentNumber,
|
|
100
|
+
context.representation.segmentSequenceCadence);
|
|
100
101
|
},
|
|
101
102
|
};
|
|
102
103
|
} else {
|
|
@@ -144,6 +145,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
144
145
|
context.representation.id,
|
|
145
146
|
context.bandwidth,
|
|
146
147
|
context.representation.getBaseUris,
|
|
148
|
+
context.urlParams,
|
|
147
149
|
periodStart,
|
|
148
150
|
periodEnd,
|
|
149
151
|
initSegmentReference,
|
|
@@ -253,6 +255,14 @@ shaka.dash.SegmentTemplate = class {
|
|
|
253
255
|
const index = MpdUtils.inheritAttribute(
|
|
254
256
|
context, SegmentTemplate.fromInheritance_, 'index');
|
|
255
257
|
|
|
258
|
+
const k = MpdUtils.inheritAttribute(
|
|
259
|
+
context, SegmentTemplate.fromInheritance_, 'k');
|
|
260
|
+
|
|
261
|
+
let numChunks = 0;
|
|
262
|
+
if (k) {
|
|
263
|
+
numChunks = parseInt(k, 10);
|
|
264
|
+
}
|
|
265
|
+
|
|
256
266
|
return {
|
|
257
267
|
segmentDuration: segmentInfo.segmentDuration,
|
|
258
268
|
timescale: segmentInfo.timescale,
|
|
@@ -265,6 +275,8 @@ shaka.dash.SegmentTemplate = class {
|
|
|
265
275
|
indexTemplate: index,
|
|
266
276
|
mimeType: context.representation.mimeType,
|
|
267
277
|
codecs: context.representation.codecs,
|
|
278
|
+
bandwidth: context.bandwidth,
|
|
279
|
+
numChunks: numChunks,
|
|
268
280
|
};
|
|
269
281
|
}
|
|
270
282
|
|
|
@@ -358,12 +370,13 @@ shaka.dash.SegmentTemplate = class {
|
|
|
358
370
|
* @param {!Object.<string, number>} periodDurationMap
|
|
359
371
|
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
360
372
|
* @param {?number} lastSegmentNumber
|
|
373
|
+
* @param {number} segmentSequenceCadence
|
|
361
374
|
* @return {!Promise.<shaka.media.SegmentIndex>}
|
|
362
375
|
* @private
|
|
363
376
|
*/
|
|
364
377
|
static generateSegmentIndexFromDuration_(
|
|
365
378
|
context, info, segmentLimit, initSegmentReference, periodDurationMap,
|
|
366
|
-
aesKey, lastSegmentNumber) {
|
|
379
|
+
aesKey, lastSegmentNumber, segmentSequenceCadence) {
|
|
367
380
|
goog.asserts.assert(info.mediaTemplate,
|
|
368
381
|
'There should be a media template with duration');
|
|
369
382
|
|
|
@@ -401,6 +414,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
401
414
|
const bandwidth = context.bandwidth || null;
|
|
402
415
|
const id = context.representation.id;
|
|
403
416
|
const getBaseUris = context.representation.getBaseUris;
|
|
417
|
+
const urlParams = context.urlParams;
|
|
404
418
|
|
|
405
419
|
const timestampOffset = periodStart - info.scaledPresentationTimeOffset;
|
|
406
420
|
|
|
@@ -483,16 +497,6 @@ shaka.dash.SegmentTemplate = class {
|
|
|
483
497
|
const segmentMediaTime = segmentPeriodTime +
|
|
484
498
|
info.scaledPresentationTimeOffset;
|
|
485
499
|
|
|
486
|
-
const getUris = () => {
|
|
487
|
-
let time = segmentMediaTime * timescale;
|
|
488
|
-
if ('BigInt' in window && time > Number.MAX_SAFE_INTEGER) {
|
|
489
|
-
time = BigInt(segmentMediaTime) * BigInt(timescale);
|
|
490
|
-
}
|
|
491
|
-
const mediaUri = MpdUtils.fillUriTemplate(
|
|
492
|
-
template, id, position, /* subNumber= */ null, bandwidth, time);
|
|
493
|
-
return ManifestParserUtils.resolveUris(getBaseUris(), [mediaUri]);
|
|
494
|
-
};
|
|
495
|
-
|
|
496
500
|
// Relative to the presentation.
|
|
497
501
|
const segmentStart = segmentPeriodTime + periodStart;
|
|
498
502
|
const trueSegmentEnd = segmentStart + segmentDuration;
|
|
@@ -505,6 +509,69 @@ shaka.dash.SegmentTemplate = class {
|
|
|
505
509
|
goog.asserts.assert(segmentStart < segmentEnd,
|
|
506
510
|
'Generated a segment outside of the period!');
|
|
507
511
|
|
|
512
|
+
const partialSegmentRefs = [];
|
|
513
|
+
|
|
514
|
+
const numChunks = info.numChunks;
|
|
515
|
+
if (numChunks) {
|
|
516
|
+
const partialDuration = (segmentEnd - segmentStart) / numChunks;
|
|
517
|
+
|
|
518
|
+
for (let i = 0; i < numChunks; i++) {
|
|
519
|
+
const start = segmentStart + partialDuration * i;
|
|
520
|
+
const end = start + partialDuration;
|
|
521
|
+
const subNumber = i + 1;
|
|
522
|
+
const getPartialUris = () => {
|
|
523
|
+
let time = segmentMediaTime * timescale;
|
|
524
|
+
if ('BigInt' in window && time > Number.MAX_SAFE_INTEGER) {
|
|
525
|
+
time = BigInt(segmentMediaTime) * BigInt(timescale);
|
|
526
|
+
}
|
|
527
|
+
const mediaUri = MpdUtils.fillUriTemplate(
|
|
528
|
+
template, id, position, subNumber, bandwidth, time);
|
|
529
|
+
return ManifestParserUtils.resolveUris(
|
|
530
|
+
getBaseUris(), [mediaUri], urlParams());
|
|
531
|
+
};
|
|
532
|
+
const partial = new shaka.media.SegmentReference(
|
|
533
|
+
start,
|
|
534
|
+
end,
|
|
535
|
+
getPartialUris,
|
|
536
|
+
/* startByte= */ 0,
|
|
537
|
+
/* endByte= */ null,
|
|
538
|
+
initSegmentReference,
|
|
539
|
+
timestampOffset,
|
|
540
|
+
/* appendWindowStart= */ periodStart,
|
|
541
|
+
/* appendWindowEnd= */ getPeriodEnd(),
|
|
542
|
+
/* partialReferences= */ [],
|
|
543
|
+
/* tilesLayout= */ '',
|
|
544
|
+
/* tileDuration= */ null,
|
|
545
|
+
/* syncTime= */ null,
|
|
546
|
+
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
547
|
+
aesKey);
|
|
548
|
+
partial.codecs = context.representation.codecs;
|
|
549
|
+
partial.mimeType = context.representation.mimeType;
|
|
550
|
+
if (segmentSequenceCadence == 0) {
|
|
551
|
+
if (i > 0) {
|
|
552
|
+
partial.markAsNonIndependent();
|
|
553
|
+
}
|
|
554
|
+
} else if ((i % segmentSequenceCadence) != 0) {
|
|
555
|
+
partial.markAsNonIndependent();
|
|
556
|
+
}
|
|
557
|
+
partialSegmentRefs.push(partial);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
const getUris = () => {
|
|
562
|
+
if (numChunks) {
|
|
563
|
+
return [];
|
|
564
|
+
}
|
|
565
|
+
let time = segmentMediaTime * timescale;
|
|
566
|
+
if ('BigInt' in window && time > Number.MAX_SAFE_INTEGER) {
|
|
567
|
+
time = BigInt(segmentMediaTime) * BigInt(timescale);
|
|
568
|
+
}
|
|
569
|
+
const mediaUri = MpdUtils.fillUriTemplate(
|
|
570
|
+
template, id, position, /* subNumber= */ null, bandwidth, time);
|
|
571
|
+
return ManifestParserUtils.resolveUris(
|
|
572
|
+
getBaseUris(), [mediaUri], urlParams());
|
|
573
|
+
};
|
|
574
|
+
|
|
508
575
|
const ref = new shaka.media.SegmentReference(
|
|
509
576
|
segmentStart,
|
|
510
577
|
segmentEnd,
|
|
@@ -515,14 +582,16 @@ shaka.dash.SegmentTemplate = class {
|
|
|
515
582
|
timestampOffset,
|
|
516
583
|
/* appendWindowStart= */ periodStart,
|
|
517
584
|
/* appendWindowEnd= */ getPeriodEnd(),
|
|
518
|
-
|
|
585
|
+
partialSegmentRefs,
|
|
519
586
|
/* tilesLayout= */ '',
|
|
520
587
|
/* tileDuration= */ null,
|
|
521
588
|
/* syncTime= */ null,
|
|
522
589
|
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
523
|
-
aesKey
|
|
590
|
+
aesKey,
|
|
591
|
+
partialSegmentRefs.length > 0);
|
|
524
592
|
ref.codecs = context.representation.codecs;
|
|
525
593
|
ref.mimeType = context.representation.mimeType;
|
|
594
|
+
ref.bandwidth = context.bandwidth;
|
|
526
595
|
// This is necessary information for thumbnail streams:
|
|
527
596
|
ref.trueEndTime = trueSegmentEnd;
|
|
528
597
|
return ref;
|
|
@@ -612,12 +681,13 @@ shaka.dash.SegmentTemplate = class {
|
|
|
612
681
|
const repId = context.representation.id;
|
|
613
682
|
const bandwidth = context.bandwidth || null;
|
|
614
683
|
const getBaseUris = context.representation.getBaseUris;
|
|
684
|
+
const urlParams = context.urlParams;
|
|
615
685
|
const getUris = () => {
|
|
616
686
|
goog.asserts.assert(initialization, 'Should have returned earler');
|
|
617
687
|
const filledTemplate = MpdUtils.fillUriTemplate(
|
|
618
688
|
initialization, repId, null, null, bandwidth, null);
|
|
619
689
|
const resolvedUris = ManifestParserUtils.resolveUris(
|
|
620
|
-
getBaseUris(), [filledTemplate]);
|
|
690
|
+
getBaseUris(), [filledTemplate], urlParams());
|
|
621
691
|
return resolvedUris;
|
|
622
692
|
};
|
|
623
693
|
const qualityInfo = shaka.dash.SegmentBase.createQualityInfo(context);
|
|
@@ -654,6 +724,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
654
724
|
* @param {?string} representationId
|
|
655
725
|
* @param {number} bandwidth
|
|
656
726
|
* @param {function():Array.<string>} getBaseUris
|
|
727
|
+
* @param {function():string} urlParams
|
|
657
728
|
* @param {number} periodStart
|
|
658
729
|
* @param {number} periodEnd
|
|
659
730
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
@@ -662,7 +733,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
662
733
|
* @param {number} segmentSequenceCadence
|
|
663
734
|
*/
|
|
664
735
|
constructor(templateInfo, representationId, bandwidth, getBaseUris,
|
|
665
|
-
periodStart, periodEnd, initSegmentReference, shouldFit,
|
|
736
|
+
urlParams, periodStart, periodEnd, initSegmentReference, shouldFit,
|
|
666
737
|
aesKey, segmentSequenceCadence) {
|
|
667
738
|
super([]);
|
|
668
739
|
|
|
@@ -674,6 +745,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
674
745
|
this.bandwidth_ = bandwidth;
|
|
675
746
|
/** @private {function():Array.<string>} */
|
|
676
747
|
this.getBaseUris_ = getBaseUris;
|
|
748
|
+
/** @private {function():string} */
|
|
749
|
+
this.urlParams_ = urlParams;
|
|
677
750
|
/** @private {number} */
|
|
678
751
|
this.periodStart_ = periodStart;
|
|
679
752
|
/** @private {number} */
|
|
@@ -933,6 +1006,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
933
1006
|
}
|
|
934
1007
|
const codecs = this.templateInfo_.codecs;
|
|
935
1008
|
const mimeType = this.templateInfo_.mimeType;
|
|
1009
|
+
const bandwidth = this.templateInfo_.bandwidth;
|
|
936
1010
|
|
|
937
1011
|
const partialSegmentRefs = [];
|
|
938
1012
|
|
|
@@ -955,7 +1029,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
955
1029
|
this.bandwidth_,
|
|
956
1030
|
timeReplacement,
|
|
957
1031
|
subNumber,
|
|
958
|
-
this.getBaseUris_
|
|
1032
|
+
this.getBaseUris_,
|
|
1033
|
+
this.urlParams_);
|
|
959
1034
|
}
|
|
960
1035
|
return uris;
|
|
961
1036
|
};
|
|
@@ -977,6 +1052,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
977
1052
|
this.aesKey_);
|
|
978
1053
|
partial.codecs = codecs;
|
|
979
1054
|
partial.mimeType = mimeType;
|
|
1055
|
+
partial.bandwidth = bandwidth;
|
|
980
1056
|
if (this.segmentSequenceCadence_ == 0) {
|
|
981
1057
|
if (i > 0) {
|
|
982
1058
|
partial.markAsNonIndependent();
|
|
@@ -1000,6 +1076,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1000
1076
|
timeReplacement,
|
|
1001
1077
|
/* subNumber= */ null,
|
|
1002
1078
|
this.getBaseUris_,
|
|
1079
|
+
this.urlParams_,
|
|
1003
1080
|
);
|
|
1004
1081
|
};
|
|
1005
1082
|
|
|
@@ -1023,6 +1100,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1023
1100
|
ref.codecs = codecs;
|
|
1024
1101
|
ref.mimeType = mimeType;
|
|
1025
1102
|
ref.trueEndTime = trueSegmentEnd;
|
|
1103
|
+
ref.bandwidth = bandwidth;
|
|
1026
1104
|
this.references[correctedPosition] = ref;
|
|
1027
1105
|
}
|
|
1028
1106
|
|
|
@@ -1036,12 +1114,12 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1036
1114
|
* @private
|
|
1037
1115
|
*/
|
|
1038
1116
|
static createUris_(mediaTemplate, repId, segmentReplacement,
|
|
1039
|
-
bandwidth, timeReplacement, subNumber, getBaseUris) {
|
|
1117
|
+
bandwidth, timeReplacement, subNumber, getBaseUris, urlParams) {
|
|
1040
1118
|
const mediaUri = shaka.dash.MpdUtils.fillUriTemplate(
|
|
1041
1119
|
mediaTemplate, repId,
|
|
1042
1120
|
segmentReplacement, subNumber, bandwidth || null, timeReplacement);
|
|
1043
1121
|
return shaka.util.ManifestParserUtils
|
|
1044
|
-
.resolveUris(getBaseUris(), [mediaUri])
|
|
1122
|
+
.resolveUris(getBaseUris(), [mediaUri], urlParams())
|
|
1045
1123
|
.map((g) => {
|
|
1046
1124
|
return g.toString();
|
|
1047
1125
|
});
|
|
@@ -1059,7 +1137,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1059
1137
|
* mediaTemplate: ?string,
|
|
1060
1138
|
* indexTemplate: ?string,
|
|
1061
1139
|
* mimeType: string,
|
|
1062
|
-
* codecs: string
|
|
1140
|
+
* codecs: string,
|
|
1141
|
+
* bandwidth: number,
|
|
1142
|
+
* numChunks: number
|
|
1063
1143
|
* }}
|
|
1064
1144
|
*
|
|
1065
1145
|
* @description
|
|
@@ -1085,5 +1165,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1085
1165
|
* The mimeType.
|
|
1086
1166
|
* @property {string} codecs
|
|
1087
1167
|
* The codecs.
|
|
1168
|
+
* @property {number} bandwidth
|
|
1169
|
+
* The bandwidth.
|
|
1170
|
+
* @property {number} numChunks
|
|
1171
|
+
* The number of chunks in each segment.
|
|
1088
1172
|
*/
|
|
1089
1173
|
shaka.dash.SegmentTemplate.SegmentTemplateInfo;
|