shaka-player 4.7.12 → 4.8.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/AUTHORS +1 -0
- package/CONTRIBUTORS +1 -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 +36 -25
- package/dist/locales.js +40 -30
- package/dist/shaka-player.compiled.d.ts +196 -46
- package/dist/shaka-player.compiled.debug.d.ts +196 -46
- package/dist/shaka-player.compiled.debug.externs.js +474 -337
- package/dist/shaka-player.compiled.debug.js +992 -871
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +474 -337
- package/dist/shaka-player.compiled.js +1248 -1174
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +259 -49
- package/dist/shaka-player.ui.debug.d.ts +259 -49
- package/dist/shaka-player.ui.debug.externs.js +591 -376
- package/dist/shaka-player.ui.debug.js +1208 -1003
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +591 -376
- package/dist/shaka-player.ui.js +1533 -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 +69 -7
- package/externs/shaka/net.js +13 -1
- package/externs/shaka/offline.js +7 -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 +240 -179
- package/lib/dash/mpd_utils.js +72 -65
- package/lib/dash/segment_base.js +35 -22
- package/lib/dash/segment_list.js +39 -31
- package/lib/dash/segment_template.js +47 -23
- package/lib/hls/hls_parser.js +376 -165
- 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 +108 -29
- package/lib/media/playhead.js +3 -3
- package/lib/media/preload_manager.js +827 -0
- package/lib/media/presentation_timeline.js +11 -0
- package/lib/media/segment_index.js +60 -49
- package/lib/media/segment_prefetch.js +140 -43
- package/lib/media/segment_reference.js +31 -8
- package/lib/media/segment_utils.js +208 -25
- package/lib/media/streaming_engine.js +321 -77
- package/lib/mss/content_protection.js +31 -25
- package/lib/mss/mss_parser.js +78 -55
- package/lib/net/networking_engine.js +49 -4
- package/lib/offline/indexeddb/v1_storage_cell.js +2 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +2 -0
- package/lib/offline/manifest_converter.js +10 -3
- package/lib/offline/storage.js +5 -3
- package/lib/player.js +896 -674
- 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 +152 -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/mime_utils.js +10 -5
- package/lib/util/mp4_box_parsers.js +346 -17
- package/lib/util/mp4_generator.js +23 -0
- package/lib/util/periods.js +24 -37
- package/lib/util/platform.js +161 -9
- package/lib/util/player_configuration.js +61 -3
- package/lib/util/stats.js +16 -0
- package/lib/util/stream_utils.js +350 -277
- 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,8 +214,10 @@ 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,
|
|
219
|
+
mimeType: context.representation.mimeType,
|
|
220
|
+
codecs: context.representation.codecs,
|
|
216
221
|
};
|
|
217
222
|
}
|
|
218
223
|
|
|
@@ -304,13 +309,14 @@ shaka.dash.SegmentTemplate = class {
|
|
|
304
309
|
* @param {number} segmentLimit The maximum number of segments to generate.
|
|
305
310
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
306
311
|
* @param {!Object.<string, number>} periodDurationMap
|
|
307
|
-
* @param {shaka.extern.
|
|
312
|
+
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
313
|
+
* @param {?number} lastSegmentNumber
|
|
308
314
|
* @return {!Promise.<shaka.media.SegmentIndex>}
|
|
309
315
|
* @private
|
|
310
316
|
*/
|
|
311
317
|
static generateSegmentIndexFromDuration_(
|
|
312
318
|
context, info, segmentLimit, initSegmentReference, periodDurationMap,
|
|
313
|
-
|
|
319
|
+
aesKey, lastSegmentNumber) {
|
|
314
320
|
goog.asserts.assert(info.mediaTemplate,
|
|
315
321
|
'There should be a media template with duration');
|
|
316
322
|
|
|
@@ -406,7 +412,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
406
412
|
const minPosition = context.dynamic ?
|
|
407
413
|
Math.max(range[0], range[1] - segmentLimit + 1) :
|
|
408
414
|
range[0];
|
|
409
|
-
const maxPosition = range[1];
|
|
415
|
+
const maxPosition = lastSegmentNumber || range[1];
|
|
410
416
|
|
|
411
417
|
const references = [];
|
|
412
418
|
const createReference = (position) => {
|
|
@@ -462,7 +468,9 @@ shaka.dash.SegmentTemplate = class {
|
|
|
462
468
|
/* tileDuration= */ null,
|
|
463
469
|
/* syncTime= */ null,
|
|
464
470
|
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
465
|
-
|
|
471
|
+
aesKey);
|
|
472
|
+
ref.codecs = context.representation.codecs;
|
|
473
|
+
ref.mimeType = context.representation.mimeType;
|
|
466
474
|
// This is necessary information for thumbnail streams:
|
|
467
475
|
ref.trueEndTime = trueSegmentEnd;
|
|
468
476
|
return ref;
|
|
@@ -525,20 +533,21 @@ shaka.dash.SegmentTemplate = class {
|
|
|
525
533
|
* Creates an init segment reference from a context object.
|
|
526
534
|
*
|
|
527
535
|
* @param {shaka.dash.DashParser.Context} context
|
|
528
|
-
* @param {shaka.extern.
|
|
536
|
+
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
529
537
|
* @return {shaka.media.InitSegmentReference}
|
|
530
538
|
* @private
|
|
531
539
|
*/
|
|
532
|
-
static createInitSegment_(context,
|
|
540
|
+
static createInitSegment_(context, aesKey) {
|
|
533
541
|
const MpdUtils = shaka.dash.MpdUtils;
|
|
534
542
|
const ManifestParserUtils = shaka.util.ManifestParserUtils;
|
|
535
543
|
const SegmentTemplate = shaka.dash.SegmentTemplate;
|
|
536
544
|
|
|
537
|
-
|
|
545
|
+
let initialization = MpdUtils.inheritAttribute(
|
|
538
546
|
context, SegmentTemplate.fromInheritance_, 'initialization');
|
|
539
547
|
if (!initialization) {
|
|
540
548
|
return null;
|
|
541
549
|
}
|
|
550
|
+
initialization = shaka.util.StringUtils.htmlUnescape(initialization);
|
|
542
551
|
|
|
543
552
|
const repId = context.representation.id;
|
|
544
553
|
const bandwidth = context.bandwidth || null;
|
|
@@ -552,14 +561,17 @@ shaka.dash.SegmentTemplate = class {
|
|
|
552
561
|
return resolvedUris;
|
|
553
562
|
};
|
|
554
563
|
const qualityInfo = shaka.dash.SegmentBase.createQualityInfo(context);
|
|
555
|
-
|
|
564
|
+
const ref = new shaka.media.InitSegmentReference(
|
|
556
565
|
getUris,
|
|
557
566
|
/* startByte= */ 0,
|
|
558
567
|
/* endByte= */ null,
|
|
559
568
|
qualityInfo,
|
|
560
569
|
/* timescale= */ null,
|
|
561
570
|
/* segmentData= */ null,
|
|
562
|
-
|
|
571
|
+
aesKey);
|
|
572
|
+
ref.codecs = context.representation.codecs;
|
|
573
|
+
ref.mimeType = context.representation.mimeType;
|
|
574
|
+
return ref;
|
|
563
575
|
}
|
|
564
576
|
};
|
|
565
577
|
|
|
@@ -586,12 +598,12 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
586
598
|
* @param {number} periodEnd
|
|
587
599
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
588
600
|
* @param {boolean} shouldFit
|
|
589
|
-
* @param {shaka.extern.
|
|
601
|
+
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
590
602
|
* @param {number} segmentSequenceCadence
|
|
591
603
|
*/
|
|
592
604
|
constructor(templateInfo, representationId, bandwidth, getBaseUris,
|
|
593
605
|
periodStart, periodEnd, initSegmentReference, shouldFit,
|
|
594
|
-
|
|
606
|
+
aesKey, segmentSequenceCadence) {
|
|
595
607
|
super([]);
|
|
596
608
|
|
|
597
609
|
/** @private {?shaka.dash.SegmentTemplate.SegmentTemplateInfo} */
|
|
@@ -608,8 +620,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
608
620
|
this.periodEnd_ = periodEnd;
|
|
609
621
|
/** @private {shaka.media.InitSegmentReference} */
|
|
610
622
|
this.initSegmentReference_ = initSegmentReference;
|
|
611
|
-
/** @private {shaka.extern.
|
|
612
|
-
this.
|
|
623
|
+
/** @private {shaka.extern.aesKey|undefined} */
|
|
624
|
+
this.aesKey_ = aesKey;
|
|
613
625
|
/** @private {number} */
|
|
614
626
|
this.segmentSequenceCadence_ = segmentSequenceCadence;
|
|
615
627
|
|
|
@@ -835,6 +847,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
835
847
|
this.periodEnd_ !== Infinity) {
|
|
836
848
|
segmentEnd = this.periodEnd_;
|
|
837
849
|
}
|
|
850
|
+
const codecs = this.templateInfo_.codecs;
|
|
851
|
+
const mimeType = this.templateInfo_.mimeType;
|
|
838
852
|
|
|
839
853
|
const partialSegmentRefs = [];
|
|
840
854
|
|
|
@@ -876,7 +890,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
876
890
|
/* tileDuration= */ null,
|
|
877
891
|
/* syncTime= */ null,
|
|
878
892
|
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
879
|
-
this.
|
|
893
|
+
this.aesKey_);
|
|
894
|
+
partial.codecs = codecs;
|
|
895
|
+
partial.mimeType = mimeType;
|
|
880
896
|
if (this.segmentSequenceCadence_ == 0) {
|
|
881
897
|
if (i > 0) {
|
|
882
898
|
partial.markAsNonIndependent();
|
|
@@ -918,8 +934,10 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
918
934
|
/* tileDuration= */ null,
|
|
919
935
|
/* syncTime= */ null,
|
|
920
936
|
shaka.media.SegmentReference.Status.AVAILABLE,
|
|
921
|
-
this.
|
|
937
|
+
this.aesKey_,
|
|
922
938
|
/* allPartialSegments= */ range.partialSegments > 0);
|
|
939
|
+
ref.codecs = codecs;
|
|
940
|
+
ref.mimeType = mimeType;
|
|
923
941
|
ref.trueEndTime = trueSegmentEnd;
|
|
924
942
|
this.references[correctedPosition] = ref;
|
|
925
943
|
}
|
|
@@ -955,7 +973,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
955
973
|
* unscaledPresentationTimeOffset: number,
|
|
956
974
|
* timeline: Array.<shaka.media.PresentationTimeline.TimeRange>,
|
|
957
975
|
* mediaTemplate: ?string,
|
|
958
|
-
* indexTemplate: ?string
|
|
976
|
+
* indexTemplate: ?string,
|
|
977
|
+
* mimeType: string,
|
|
978
|
+
* codecs: string
|
|
959
979
|
* }}
|
|
960
980
|
*
|
|
961
981
|
* @description
|
|
@@ -977,5 +997,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
977
997
|
* The media URI template, if given.
|
|
978
998
|
* @property {?string} indexTemplate
|
|
979
999
|
* The index URI template, if given.
|
|
1000
|
+
* @property {string} mimeType
|
|
1001
|
+
* The mimeType.
|
|
1002
|
+
* @property {string} codecs
|
|
1003
|
+
* The codecs.
|
|
980
1004
|
*/
|
|
981
1005
|
shaka.dash.SegmentTemplate.SegmentTemplateInfo;
|