shaka-player 4.7.13 → 4.8.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/AUTHORS +2 -0
- package/CONTRIBUTORS +2 -0
- package/LICENSE +54 -0
- package/README.md +22 -1
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +34 -23
- package/dist/locales.js +41 -31
- package/dist/shaka-player.compiled.d.ts +196 -45
- package/dist/shaka-player.compiled.debug.d.ts +196 -45
- package/dist/shaka-player.compiled.debug.externs.js +491 -348
- package/dist/shaka-player.compiled.debug.js +969 -847
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +491 -348
- package/dist/shaka-player.compiled.js +1238 -1171
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +259 -48
- package/dist/shaka-player.ui.debug.d.ts +259 -48
- package/dist/shaka-player.ui.debug.externs.js +598 -377
- package/dist/shaka-player.ui.debug.js +1185 -980
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +598 -377
- package/dist/shaka-player.ui.js +1526 -1408
- package/dist/shaka-player.ui.map +4 -4
- package/externs/device_sensor_event.js +18 -0
- package/externs/hisense.js +16 -0
- package/externs/playstation.js +31 -0
- package/externs/shaka/abr_manager.js +3 -1
- package/externs/shaka/ads.js +5 -0
- package/externs/shaka/codecs.js +13 -0
- package/externs/shaka/manifest.js +58 -6
- package/externs/shaka/net.js +13 -1
- package/externs/shaka/player.js +184 -13
- package/externs/shaka/text.js +19 -0
- package/externs/tizen.js +41 -0
- package/externs/webos.js +19 -0
- package/externs/xbox.js +43 -0
- package/lib/abr/simple_abr_manager.js +9 -1
- package/lib/ads/ad_manager.js +19 -2
- package/lib/ads/client_side_ad_manager.js +5 -3
- package/lib/ads/media_tailor_ad_manager.js +9 -0
- package/lib/cast/cast_receiver.js +0 -14
- package/lib/cast/cast_utils.js +1 -0
- package/lib/cea/mp4_cea_parser.js +6 -1
- package/lib/dash/content_protection.js +97 -53
- package/lib/dash/dash_parser.js +237 -177
- package/lib/dash/mpd_utils.js +72 -65
- package/lib/dash/segment_base.js +27 -21
- package/lib/dash/segment_list.js +18 -16
- package/lib/dash/segment_template.js +45 -22
- package/lib/hls/hls_parser.js +358 -164
- package/lib/media/buffering_observer.js +25 -1
- package/lib/media/drm_engine.js +91 -71
- package/lib/media/manifest_filterer.js +220 -0
- package/lib/media/media_source_engine.js +34 -5
- package/lib/media/preload_manager.js +827 -0
- package/lib/media/presentation_timeline.js +11 -0
- package/lib/media/segment_index.js +93 -47
- package/lib/media/segment_prefetch.js +140 -43
- package/lib/media/segment_reference.js +43 -8
- package/lib/media/segment_utils.js +208 -25
- package/lib/media/streaming_engine.js +355 -66
- package/lib/mss/content_protection.js +31 -25
- package/lib/mss/mss_parser.js +79 -55
- package/lib/net/networking_engine.js +49 -4
- package/lib/offline/storage.js +3 -3
- package/lib/player.js +882 -672
- package/lib/polyfill/media_capabilities.js +16 -1
- package/lib/text/simple_text_displayer.js +9 -0
- package/lib/text/stub_text_displayer.js +7 -0
- package/lib/text/text_engine.js +16 -3
- package/lib/text/ttml_text_parser.js +116 -114
- package/lib/text/ui_text_displayer.js +28 -11
- package/lib/text/vtt_text_parser.js +54 -115
- package/lib/transmuxer/opus.js +91 -0
- package/lib/transmuxer/ts_transmuxer.js +115 -0
- package/lib/util/cmcd_manager.js +153 -3
- package/lib/util/dom_utils.js +11 -0
- package/lib/util/error.js +5 -0
- package/lib/util/fake_event.js +2 -0
- package/lib/util/manifest_parser_utils.js +97 -3
- package/lib/util/mp4_box_parsers.js +346 -17
- package/lib/util/mp4_generator.js +23 -0
- package/lib/util/periods.js +19 -0
- package/lib/util/platform.js +161 -9
- package/lib/util/player_configuration.js +79 -13
- package/lib/util/stats.js +16 -0
- package/lib/util/stream_utils.js +22 -8
- package/lib/util/string_utils.js +36 -0
- package/lib/util/tXml.js +814 -0
- package/lib/util/ts_parser.js +50 -0
- package/lib/util/xml_utils.js +10 -338
- package/package.json +2 -2
- package/shaka-player.uncompiled.js +8 -0
- package/ui/controls.js +187 -5
- package/ui/enums.js +2 -0
- package/ui/externs/ui.js +30 -3
- package/ui/gl_matrix/matrix_4x4.js +568 -0
- package/ui/gl_matrix/matrix_quaternion.js +45 -0
- package/ui/less/containers.less +11 -0
- package/ui/locales/en-GB.json +2 -0
- package/ui/locales/en.json +2 -0
- package/ui/locales/es-419.json +2 -0
- package/ui/locales/es.json +2 -0
- package/ui/locales/source.json +8 -0
- package/ui/recenter_vr.js +126 -0
- package/ui/resolution_selection.js +25 -5
- package/ui/statistics_button.js +12 -0
- package/ui/text_selection.js +1 -1
- package/ui/toggle_stereoscopic.js +127 -0
- package/ui/ui.js +74 -38
- package/ui/vr_manager.js +557 -0
- package/ui/vr_utils.js +232 -0
- package/ui/vr_webgl.js +697 -0
|
@@ -17,6 +17,7 @@ goog.require('shaka.util.Error');
|
|
|
17
17
|
goog.require('shaka.util.IReleasable');
|
|
18
18
|
goog.require('shaka.util.ManifestParserUtils');
|
|
19
19
|
goog.require('shaka.util.ObjectUtils');
|
|
20
|
+
goog.require('shaka.util.StringUtils');
|
|
20
21
|
goog.requireType('shaka.dash.DashParser');
|
|
21
22
|
goog.requireType('shaka.media.PresentationTimeline');
|
|
22
23
|
|
|
@@ -36,19 +37,20 @@ shaka.dash.SegmentTemplate = class {
|
|
|
36
37
|
* @param {number} segmentLimit The maximum number of segments to generate for
|
|
37
38
|
* a SegmentTemplate with fixed duration.
|
|
38
39
|
* @param {!Object.<string, number>} periodDurationMap
|
|
39
|
-
* @param {shaka.extern.
|
|
40
|
+
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
41
|
+
* @param {?number} lastSegmentNumber
|
|
40
42
|
* @return {shaka.dash.DashParser.StreamInfo}
|
|
41
43
|
*/
|
|
42
44
|
static createStreamInfo(
|
|
43
45
|
context, requestSegment, streamMap, isUpdate, segmentLimit,
|
|
44
|
-
periodDurationMap,
|
|
46
|
+
periodDurationMap, aesKey, lastSegmentNumber) {
|
|
45
47
|
goog.asserts.assert(context.representation.segmentTemplate,
|
|
46
48
|
'Should only be called with SegmentTemplate');
|
|
47
49
|
const SegmentTemplate = shaka.dash.SegmentTemplate;
|
|
48
50
|
const TimelineSegmentIndex = shaka.dash.TimelineSegmentIndex;
|
|
49
51
|
|
|
50
52
|
const initSegmentReference =
|
|
51
|
-
SegmentTemplate.createInitSegment_(context,
|
|
53
|
+
SegmentTemplate.createInitSegment_(context, aesKey);
|
|
52
54
|
|
|
53
55
|
/** @type {shaka.dash.SegmentTemplate.SegmentTemplateInfo} */
|
|
54
56
|
const info = SegmentTemplate.parseSegmentTemplateInfo_(context);
|
|
@@ -84,7 +86,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
84
86
|
generateSegmentIndex: () => {
|
|
85
87
|
return SegmentTemplate.generateSegmentIndexFromDuration_(
|
|
86
88
|
shallowCopyOfContext, info, segmentLimit, initSegmentReference,
|
|
87
|
-
periodDurationMap,
|
|
89
|
+
periodDurationMap, aesKey, lastSegmentNumber);
|
|
88
90
|
},
|
|
89
91
|
};
|
|
90
92
|
} else {
|
|
@@ -136,7 +138,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
136
138
|
periodEnd,
|
|
137
139
|
initSegmentReference,
|
|
138
140
|
shouldFit,
|
|
139
|
-
|
|
141
|
+
aesKey,
|
|
140
142
|
context.representation.segmentSequenceCadence,
|
|
141
143
|
);
|
|
142
144
|
} else {
|
|
@@ -178,7 +180,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
178
180
|
|
|
179
181
|
/**
|
|
180
182
|
* @param {?shaka.dash.DashParser.InheritanceFrame} frame
|
|
181
|
-
* @return {
|
|
183
|
+
* @return {?shaka.extern.xml.Node}
|
|
182
184
|
* @private
|
|
183
185
|
*/
|
|
184
186
|
static fromInheritance_(frame) {
|
|
@@ -195,6 +197,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
195
197
|
static parseSegmentTemplateInfo_(context) {
|
|
196
198
|
const SegmentTemplate = shaka.dash.SegmentTemplate;
|
|
197
199
|
const MpdUtils = shaka.dash.MpdUtils;
|
|
200
|
+
const StringUtils = shaka.util.StringUtils;
|
|
198
201
|
const segmentInfo =
|
|
199
202
|
MpdUtils.parseSegmentInfo(context, SegmentTemplate.fromInheritance_);
|
|
200
203
|
|
|
@@ -211,7 +214,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
211
214
|
unscaledPresentationTimeOffset:
|
|
212
215
|
segmentInfo.unscaledPresentationTimeOffset,
|
|
213
216
|
timeline: segmentInfo.timeline,
|
|
214
|
-
mediaTemplate: media,
|
|
217
|
+
mediaTemplate: media && StringUtils.htmlUnescape(media),
|
|
215
218
|
indexTemplate: index,
|
|
216
219
|
mimeType: context.representation.mimeType,
|
|
217
220
|
codecs: context.representation.codecs,
|
|
@@ -306,13 +309,14 @@ shaka.dash.SegmentTemplate = class {
|
|
|
306
309
|
* @param {number} segmentLimit The maximum number of segments to generate.
|
|
307
310
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
308
311
|
* @param {!Object.<string, number>} periodDurationMap
|
|
309
|
-
* @param {shaka.extern.
|
|
312
|
+
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
313
|
+
* @param {?number} lastSegmentNumber
|
|
310
314
|
* @return {!Promise.<shaka.media.SegmentIndex>}
|
|
311
315
|
* @private
|
|
312
316
|
*/
|
|
313
317
|
static generateSegmentIndexFromDuration_(
|
|
314
318
|
context, info, segmentLimit, initSegmentReference, periodDurationMap,
|
|
315
|
-
|
|
319
|
+
aesKey, lastSegmentNumber) {
|
|
316
320
|
goog.asserts.assert(info.mediaTemplate,
|
|
317
321
|
'There should be a media template with duration');
|
|
318
322
|
|
|
@@ -408,7 +412,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
408
412
|
const minPosition = context.dynamic ?
|
|
409
413
|
Math.max(range[0], range[1] - segmentLimit + 1) :
|
|
410
414
|
range[0];
|
|
411
|
-
const maxPosition = range[1];
|
|
415
|
+
const maxPosition = lastSegmentNumber || range[1];
|
|
412
416
|
|
|
413
417
|
const references = [];
|
|
414
418
|
const createReference = (position) => {
|
|
@@ -464,7 +468,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
464
468
|
/* tileDuration= */ null,
|
|
465
469
|
/* syncTime= */ null,
|
|
466
470
|
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
467
|
-
|
|
471
|
+
aesKey);
|
|
468
472
|
ref.codecs = context.representation.codecs;
|
|
469
473
|
ref.mimeType = context.representation.mimeType;
|
|
470
474
|
// This is necessary information for thumbnail streams:
|
|
@@ -529,20 +533,21 @@ shaka.dash.SegmentTemplate = class {
|
|
|
529
533
|
* Creates an init segment reference from a context object.
|
|
530
534
|
*
|
|
531
535
|
* @param {shaka.dash.DashParser.Context} context
|
|
532
|
-
* @param {shaka.extern.
|
|
536
|
+
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
533
537
|
* @return {shaka.media.InitSegmentReference}
|
|
534
538
|
* @private
|
|
535
539
|
*/
|
|
536
|
-
static createInitSegment_(context,
|
|
540
|
+
static createInitSegment_(context, aesKey) {
|
|
537
541
|
const MpdUtils = shaka.dash.MpdUtils;
|
|
538
542
|
const ManifestParserUtils = shaka.util.ManifestParserUtils;
|
|
539
543
|
const SegmentTemplate = shaka.dash.SegmentTemplate;
|
|
540
544
|
|
|
541
|
-
|
|
545
|
+
let initialization = MpdUtils.inheritAttribute(
|
|
542
546
|
context, SegmentTemplate.fromInheritance_, 'initialization');
|
|
543
547
|
if (!initialization) {
|
|
544
548
|
return null;
|
|
545
549
|
}
|
|
550
|
+
initialization = shaka.util.StringUtils.htmlUnescape(initialization);
|
|
546
551
|
|
|
547
552
|
const repId = context.representation.id;
|
|
548
553
|
const bandwidth = context.bandwidth || null;
|
|
@@ -563,7 +568,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
563
568
|
qualityInfo,
|
|
564
569
|
/* timescale= */ null,
|
|
565
570
|
/* segmentData= */ null,
|
|
566
|
-
|
|
571
|
+
aesKey);
|
|
567
572
|
ref.codecs = context.representation.codecs;
|
|
568
573
|
ref.mimeType = context.representation.mimeType;
|
|
569
574
|
return ref;
|
|
@@ -593,12 +598,12 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
593
598
|
* @param {number} periodEnd
|
|
594
599
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
595
600
|
* @param {boolean} shouldFit
|
|
596
|
-
* @param {shaka.extern.
|
|
601
|
+
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
597
602
|
* @param {number} segmentSequenceCadence
|
|
598
603
|
*/
|
|
599
604
|
constructor(templateInfo, representationId, bandwidth, getBaseUris,
|
|
600
605
|
periodStart, periodEnd, initSegmentReference, shouldFit,
|
|
601
|
-
|
|
606
|
+
aesKey, segmentSequenceCadence) {
|
|
602
607
|
super([]);
|
|
603
608
|
|
|
604
609
|
/** @private {?shaka.dash.SegmentTemplate.SegmentTemplateInfo} */
|
|
@@ -615,8 +620,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
615
620
|
this.periodEnd_ = periodEnd;
|
|
616
621
|
/** @private {shaka.media.InitSegmentReference} */
|
|
617
622
|
this.initSegmentReference_ = initSegmentReference;
|
|
618
|
-
/** @private {shaka.extern.
|
|
619
|
-
this.
|
|
623
|
+
/** @private {shaka.extern.aesKey|undefined} */
|
|
624
|
+
this.aesKey_ = aesKey;
|
|
620
625
|
/** @private {number} */
|
|
621
626
|
this.segmentSequenceCadence_ = segmentSequenceCadence;
|
|
622
627
|
|
|
@@ -696,7 +701,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
696
701
|
*/
|
|
697
702
|
appendTemplateInfo(info, periodStart, periodEnd, shouldFit,
|
|
698
703
|
initSegmentReference) {
|
|
699
|
-
this.
|
|
704
|
+
this.updateInitSegmentReference(initSegmentReference);
|
|
700
705
|
if (!this.templateInfo_) {
|
|
701
706
|
this.templateInfo_ = info;
|
|
702
707
|
this.periodStart_ = periodStart;
|
|
@@ -727,6 +732,24 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
727
732
|
}
|
|
728
733
|
}
|
|
729
734
|
|
|
735
|
+
/**
|
|
736
|
+
* Updates the init segment reference and propagates the update to all
|
|
737
|
+
* references.
|
|
738
|
+
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
739
|
+
*/
|
|
740
|
+
updateInitSegmentReference(initSegmentReference) {
|
|
741
|
+
if (this.initSegmentReference_ === initSegmentReference) {
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
this.initSegmentReference_ = initSegmentReference;
|
|
746
|
+
for (const reference of this.references) {
|
|
747
|
+
if (reference) {
|
|
748
|
+
reference.updateInitSegmentReference(initSegmentReference);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
730
753
|
/**
|
|
731
754
|
*
|
|
732
755
|
* @param {number} time
|
|
@@ -885,7 +908,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
885
908
|
/* tileDuration= */ null,
|
|
886
909
|
/* syncTime= */ null,
|
|
887
910
|
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
888
|
-
this.
|
|
911
|
+
this.aesKey_);
|
|
889
912
|
partial.codecs = codecs;
|
|
890
913
|
partial.mimeType = mimeType;
|
|
891
914
|
if (this.segmentSequenceCadence_ == 0) {
|
|
@@ -929,7 +952,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
929
952
|
/* tileDuration= */ null,
|
|
930
953
|
/* syncTime= */ null,
|
|
931
954
|
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
932
|
-
this.
|
|
955
|
+
this.aesKey_,
|
|
933
956
|
/* allPartialSegments= */ range.partialSegments > 0);
|
|
934
957
|
ref.codecs = codecs;
|
|
935
958
|
ref.mimeType = mimeType;
|