shaka-player 4.7.11 → 4.7.13

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.
Files changed (60) hide show
  1. package/README.md +2 -4
  2. package/dist/deps.js +6 -7
  3. package/dist/locales.js +34 -34
  4. package/dist/shaka-player.compiled.d.ts +14 -12
  5. package/dist/shaka-player.compiled.debug.d.ts +14 -12
  6. package/dist/shaka-player.compiled.debug.externs.js +78 -64
  7. package/dist/shaka-player.compiled.debug.js +321 -312
  8. package/dist/shaka-player.compiled.debug.map +4 -4
  9. package/dist/shaka-player.compiled.externs.js +78 -64
  10. package/dist/shaka-player.compiled.js +1167 -1153
  11. package/dist/shaka-player.compiled.map +4 -4
  12. package/dist/shaka-player.ui.d.ts +14 -12
  13. package/dist/shaka-player.ui.debug.d.ts +14 -12
  14. package/dist/shaka-player.ui.debug.externs.js +78 -64
  15. package/dist/shaka-player.ui.debug.js +443 -434
  16. package/dist/shaka-player.ui.debug.map +4 -4
  17. package/dist/shaka-player.ui.externs.js +78 -64
  18. package/dist/shaka-player.ui.js +1319 -1305
  19. package/dist/shaka-player.ui.map +4 -4
  20. package/externs/shaka/manifest.js +11 -1
  21. package/externs/shaka/offline.js +7 -1
  22. package/externs/shaka/player.js +32 -19
  23. package/lib/abr/simple_abr_manager.js +21 -26
  24. package/lib/cast/cast_proxy.js +1 -3
  25. package/lib/cast/cast_sender.js +8 -11
  26. package/lib/cea/cea608_memory.js +1 -1
  27. package/lib/cea/ts_cea_parser.js +10 -1
  28. package/lib/dash/dash_parser.js +13 -3
  29. package/lib/dash/segment_base.js +8 -1
  30. package/lib/dash/segment_list.js +24 -18
  31. package/lib/dash/segment_template.js +21 -2
  32. package/lib/hls/hls_parser.js +36 -17
  33. package/lib/media/drm_engine.js +6 -3
  34. package/lib/media/media_source_engine.js +96 -33
  35. package/lib/media/playhead.js +3 -3
  36. package/lib/media/presentation_timeline.js +23 -0
  37. package/lib/media/segment_index.js +21 -20
  38. package/lib/media/segment_utils.js +10 -1
  39. package/lib/media/streaming_engine.js +2 -14
  40. package/lib/mss/mss_parser.js +4 -0
  41. package/lib/offline/indexeddb/v1_storage_cell.js +2 -0
  42. package/lib/offline/indexeddb/v2_storage_cell.js +2 -0
  43. package/lib/offline/manifest_converter.js +10 -3
  44. package/lib/offline/storage.js +2 -0
  45. package/lib/player.js +30 -4
  46. package/lib/polyfill/media_capabilities.js +20 -1
  47. package/lib/polyfill/mediasource.js +37 -14
  48. package/lib/text/vtt_text_parser.js +51 -51
  49. package/lib/transmuxer/h264.js +3 -3
  50. package/lib/transmuxer/h265.js +3 -3
  51. package/lib/transmuxer/ts_transmuxer.js +42 -3
  52. package/lib/util/manifest_parser_utils.js +1 -0
  53. package/lib/util/mime_utils.js +10 -5
  54. package/lib/util/mp4_parser.js +57 -0
  55. package/lib/util/periods.js +5 -37
  56. package/lib/util/platform.js +4 -0
  57. package/lib/util/stream_utils.js +334 -271
  58. package/lib/util/ts_parser.js +99 -10
  59. package/package.json +1 -1
  60. package/lib/polyfill/storage_estimate.js +0 -57
@@ -400,7 +400,8 @@ shaka.extern.FetchCryptoKeysFunction;
400
400
  * undefined),
401
401
  * mssPrivateData: (shaka.extern.MssPrivateData|undefined),
402
402
  * external: boolean,
403
- * fastSwitching: boolean
403
+ * fastSwitching: boolean,
404
+ * fullMimeTypes: !Set.<string>
404
405
  * }}
405
406
  *
406
407
  * @description
@@ -430,10 +431,14 @@ shaka.extern.FetchCryptoKeysFunction;
430
431
  * @property {string} mimeType
431
432
  * <i>Required.</i> <br>
432
433
  * The Stream's MIME type, e.g., 'audio/mp4', 'video/webm', or 'text/vtt'.
434
+ * In the case of a stream that adapts between different periods with
435
+ * different MIME types, this represents only the first period.
433
436
  * @property {string} codecs
434
437
  * <i>Defaults to '' (i.e., unknown / not needed).</i> <br>
435
438
  * The Stream's codecs, e.g., 'avc1.4d4015' or 'vp9', which must be
436
439
  * compatible with the Stream's MIME type. <br>
440
+ * In the case of a stream that adapts between different periods with
441
+ * different codecs, this represents only the first period.
437
442
  * See {@link https://tools.ietf.org/html/rfc6381}
438
443
  * @property {(number|undefined)} frameRate
439
444
  * <i>Video streams only.</i> <br>
@@ -535,6 +540,11 @@ shaka.extern.FetchCryptoKeysFunction;
535
540
  * Eg: external text tracks.
536
541
  * @property {boolean} fastSwitching
537
542
  * Indicate if the stream should be used for fast switching.
543
+ * @property {!Set.<string>} fullMimeTypes
544
+ * A set of full MIME types (e.g. MIME types plus codecs information), that
545
+ * represents the types used in each period of the original manifest.
546
+ * Meant for being used by compatibility checking, such as with
547
+ * MediaSource.isTypeSupported.
538
548
  *
539
549
  * @exportDoc
540
550
  */
@@ -230,7 +230,9 @@ shaka.extern.StreamDB;
230
230
  * tilesLayout: ?string,
231
231
  * pendingSegmentRefId: (string|undefined),
232
232
  * pendingInitSegmentRefId: (string|undefined),
233
- * dataKey: number
233
+ * dataKey: number,
234
+ * mimeType: ?string,
235
+ * codecs: ?string
234
236
  * }}
235
237
  *
236
238
  * @property {?number} initSegmentKey
@@ -263,6 +265,10 @@ shaka.extern.StreamDB;
263
265
  * downloaded.
264
266
  * @property {number} dataKey
265
267
  * The key to the data in storage.
268
+ * @property {?string} mimeType
269
+ * The mimeType of the segment.
270
+ * @property {?string} codecs
271
+ * The codecs of the segment.
266
272
  */
267
273
  shaka.extern.SegmentDB;
268
274
 
@@ -96,57 +96,70 @@ shaka.extern.StateChange;
96
96
  * again.
97
97
  *
98
98
  * @property {number} width
99
- * The width of the current video track.
99
+ * The width of the current video track. If nothing is loaded or the content
100
+ * is audio-only, NaN.
100
101
  * @property {number} height
101
- * The height of the current video track.
102
+ * The height of the current video track. If nothing is loaded or the content
103
+ * is audio-only, NaN.
102
104
  * @property {number} streamBandwidth
103
105
  * The bandwidth required for the current streams (total, in bit/sec).
104
- * It takes into account the playbackrate.
106
+ * It takes into account the playbackrate. If nothing is loaded, NaN.
105
107
  *
106
108
  * @property {number} decodedFrames
107
- * The total number of frames decoded by the Player. This may be
108
- * <code>NaN</code> if this is not supported by the browser.
109
+ * The total number of frames decoded by the Player. If not reported by the
110
+ * browser, NaN.
109
111
  * @property {number} droppedFrames
110
- * The total number of frames dropped by the Player. This may be
111
- * <code>NaN</code> if this is not supported by the browser.
112
+ * The total number of frames dropped by the Player. If not reported by the
113
+ * browser, NaN.
112
114
  * @property {number} corruptedFrames
113
- * The total number of corrupted frames dropped by the browser. This may be
114
- * <code>NaN</code> if this is not supported by the browser.
115
+ * The total number of corrupted frames dropped by the browser. If not
116
+ * reported by the browser, NaN.
115
117
  * @property {number} estimatedBandwidth
116
- * The current estimated network bandwidth (in bit/sec).
118
+ * The current estimated network bandwidth (in bit/sec). If no estimate
119
+ * available, NaN.
117
120
  *
118
121
  * @property {number} gapsJumped
119
122
  * The total number of playback gaps jumped by the GapJumpingController.
123
+ * If nothing is loaded, NaN.
120
124
  * @property {number} stallsDetected
121
125
  * The total number of playback stalls detected by the StallDetector.
126
+ * If nothing is loaded, NaN.
122
127
  *
123
128
  * @property {number} completionPercent
124
129
  * This is the greatest completion percent that the user has experienced in
125
- * playback. Also known as the "high water mark". Is NaN when there is no
126
- * known duration, such as for livestreams.
130
+ * playback. Also known as the "high water mark". If nothing is loaded, or
131
+ * the stream is live (and therefore indefinite), NaN.
127
132
  * @property {number} loadLatency
128
133
  * This is the number of seconds it took for the video element to have enough
129
134
  * data to begin playback. This is measured from the time load() is called to
130
135
  * the time the <code>'loadeddata'</code> event is fired by the media element.
136
+ * If nothing is loaded, NaN.
131
137
  * @property {number} manifestTimeSeconds
132
138
  * The amount of time it took to download and parse the manifest.
139
+ * If nothing is loaded, NaN.
133
140
  * @property {number} drmTimeSeconds
134
141
  * The amount of time it took to download the first drm key, and load that key
135
- * into the drm system.
142
+ * into the drm system. If nothing is loaded or DRM is not in use, NaN.
136
143
  * @property {number} playTime
137
- * The total time spent in a playing state in seconds.
144
+ * The total time spent in a playing state in seconds. If nothing is loaded,
145
+ * NaN.
138
146
  * @property {number} pauseTime
139
- * The total time spent in a paused state in seconds.
147
+ * The total time spent in a paused state in seconds. If nothing is loaded,
148
+ * NaN.
140
149
  * @property {number} bufferingTime
141
- * The total time spent in a buffering state in seconds.
150
+ * The total time spent in a buffering state in seconds. If nothing is
151
+ * loaded, NaN.
142
152
  * @property {number} licenseTime
143
- * The time spent on license requests during this session in seconds, or NaN.
153
+ * The time spent on license requests during this session in seconds. If DRM
154
+ * is not in use, NaN.
144
155
  * @property {number} liveLatency
145
156
  * The time between the capturing of a frame and the end user having it
146
- * displayed on their screen.
157
+ * displayed on their screen. If nothing is loaded or the content is VOD,
158
+ * NaN.
147
159
  *
148
160
  * @property {number} maxSegmentDuration
149
- * The presentation's max segment duration in seconds, or NaN.
161
+ * The presentation's max segment duration in seconds. If nothing is loaded,
162
+ * NaN.
150
163
  *
151
164
  * @property {!Array.<shaka.extern.TrackChoice>} switchHistory
152
165
  * A history of the stream changes.
@@ -6,10 +6,11 @@
6
6
 
7
7
  goog.provide('shaka.abr.SimpleAbrManager');
8
8
 
9
- goog.require('shaka.util.IReleasable');
10
9
  goog.require('goog.asserts');
11
10
  goog.require('shaka.abr.EwmaBandwidthEstimator');
12
11
  goog.require('shaka.log');
12
+ goog.require('shaka.util.EventManager');
13
+ goog.require('shaka.util.IReleasable');
13
14
  goog.require('shaka.util.StreamUtils');
14
15
  goog.require('shaka.util.Timer');
15
16
 
@@ -50,30 +51,30 @@ shaka.abr.SimpleAbrManager = class {
50
51
  /** @private {shaka.abr.EwmaBandwidthEstimator} */
51
52
  this.bandwidthEstimator_ = new shaka.abr.EwmaBandwidthEstimator();
52
53
 
53
- /** @private {?function():void} */
54
- this.onNetworkInformationChange_ = null;
54
+ /** @private {!shaka.util.EventManager} */
55
+ this.eventManager_ = new shaka.util.EventManager();
55
56
 
56
57
  // Some browsers implement the Network Information API, which allows
57
58
  // retrieving information about a user's network connection. We listen
58
59
  // to the change event to be able to make quick changes in case the type
59
60
  // of connectivity changes.
60
61
  if (navigator.connection && navigator.connection.addEventListener) {
61
- this.onNetworkInformationChange_ = () => {
62
- if (this.enabled_ && this.config_.useNetworkInformation) {
63
- this.bandwidthEstimator_ = new shaka.abr.EwmaBandwidthEstimator();
64
- if (this.config_) {
65
- this.bandwidthEstimator_.configure(this.config_.advanced);
66
- }
67
- const chosenVariant = this.chooseVariant();
68
- if (chosenVariant && navigator.onLine) {
69
- this.switch_(chosenVariant, this.config_.clearBufferSwitch,
70
- this.config_.safeMarginSwitch);
71
- }
72
- }
73
- };
74
-
75
- navigator.connection.addEventListener(
76
- 'change', this.onNetworkInformationChange_);
62
+ this.eventManager_.listen(
63
+ /** @type {EventTarget} */(navigator.connection),
64
+ 'change',
65
+ () => {
66
+ if (this.enabled_ && this.config_.useNetworkInformation) {
67
+ this.bandwidthEstimator_ = new shaka.abr.EwmaBandwidthEstimator();
68
+ if (this.config_) {
69
+ this.bandwidthEstimator_.configure(this.config_.advanced);
70
+ }
71
+ const chosenVariant = this.chooseVariant();
72
+ if (chosenVariant && navigator.onLine) {
73
+ this.switch_(chosenVariant, this.config_.clearBufferSwitch,
74
+ this.config_.safeMarginSwitch);
75
+ }
76
+ }
77
+ });
77
78
  }
78
79
 
79
80
  /**
@@ -151,13 +152,7 @@ shaka.abr.SimpleAbrManager = class {
151
152
  */
152
153
  release() {
153
154
  // stop() should already have been called for unload
154
-
155
- if (navigator.connection && navigator.connection.removeEventListener) {
156
- navigator.connection.removeEventListener(
157
- 'change', this.onNetworkInformationChange_);
158
- this.onNetworkInformationChange_ = null;
159
- }
160
-
155
+ this.eventManager_.release();
161
156
  this.resizeObserverTimer_ = null;
162
157
  }
163
158
 
@@ -188,12 +188,10 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
188
188
  * @export
189
189
  */
190
190
  async cast() {
191
- const initState = this.getInitState_();
192
-
193
191
  // TODO: transfer manually-selected tracks?
194
192
  // TODO: transfer side-loaded text tracks?
195
193
 
196
- await this.sender_.cast(initState);
194
+ await this.sender_.cast();
197
195
  if (!this.localPlayer_) {
198
196
  // We've already been destroyed.
199
197
  return;
@@ -261,12 +261,10 @@ shaka.cast.CastSender = class {
261
261
 
262
262
 
263
263
  /**
264
- * @param {shaka.cast.CastUtils.InitStateType} initState Video and player
265
- * state to be sent to the receiver.
266
264
  * @return {!Promise} Resolved when connected to a receiver. Rejected if the
267
265
  * connection fails or is canceled by the user.
268
266
  */
269
- async cast(initState) {
267
+ async cast() {
270
268
  if (!this.apiReady_) {
271
269
  throw new shaka.util.Error(
272
270
  shaka.util.Error.Severity.RECOVERABLE,
@@ -288,7 +286,7 @@ shaka.cast.CastSender = class {
288
286
 
289
287
  this.castPromise_ = new shaka.util.PublicPromise();
290
288
  chrome.cast.requestSession(
291
- (session) => this.onSessionInitiated_(initState, session),
289
+ (session) => this.onSessionInitiated_(session),
292
290
  (error) => this.onConnectionError_(error));
293
291
  await this.castPromise_;
294
292
  }
@@ -303,10 +301,9 @@ shaka.cast.CastSender = class {
303
301
  if (!this.isCasting_) {
304
302
  return;
305
303
  }
306
- const initState = this.onInitStateRequired_();
307
304
 
308
305
  chrome.cast.requestSession(
309
- (session) => this.onSessionInitiated_(initState, session),
306
+ (session) => this.onSessionInitiated_(session),
310
307
  (error) => this.onConnectionError_(error));
311
308
  }
312
309
 
@@ -401,12 +398,14 @@ shaka.cast.CastSender = class {
401
398
 
402
399
 
403
400
  /**
404
- * @param {shaka.cast.CastUtils.InitStateType} initState
405
401
  * @param {chrome.cast.Session} session
406
402
  * @private
407
403
  */
408
- onSessionInitiated_(initState, session) {
404
+ onSessionInitiated_(session) {
409
405
  shaka.log.debug('CastSender: onSessionInitiated');
406
+
407
+ const initState = this.onInitStateRequired_();
408
+
410
409
  this.onSessionCreated_(session);
411
410
 
412
411
  this.sendMessage_({
@@ -529,12 +528,10 @@ shaka.cast.CastSender = class {
529
528
  onExistingSessionJoined_(session) {
530
529
  shaka.log.debug('CastSender: onExistingSessionJoined');
531
530
 
532
- const initState = this.onInitStateRequired_();
533
-
534
531
  this.castPromise_ = new shaka.util.PublicPromise();
535
532
  this.hasJoinedExistingSession_ = true;
536
533
 
537
- this.onSessionInitiated_(initState, session);
534
+ this.onSessionInitiated_(session);
538
535
  }
539
536
 
540
537
 
@@ -293,7 +293,7 @@ shaka.cea.Cea608Memory.CharSet.BasicNorthAmericanChars = new Map([
293
293
  */
294
294
  shaka.cea.Cea608Memory.CharSet.SpecialNorthAmericanChars = new Map([
295
295
  [0x30, '®'], [0x31, '°'], [0x32, '½'], [0x33, '¿'], [0x34, '™'], [0x35, '¢'],
296
- [0x36, '£'], [0x37, '♪'], [0x38, 'à'], [0x39, '⠀'], [0x3a, 'è'], [0x3b, 'â'],
296
+ [0x36, '£'], [0x37, '♪'], [0x38, 'à'], [0x39, ' '], [0x3a, 'è'], [0x3b, 'â'],
297
297
  [0x3c, 'ê'], [0x3d, 'î'], [0x3e, 'ô'], [0x3f, 'û'],
298
298
  ]);
299
299
 
@@ -26,6 +26,9 @@ shaka.cea.TsCeaParser = class {
26
26
  * @const {!shaka.cea.SeiProcessor}
27
27
  */
28
28
  this.seiProcessor_ = new shaka.cea.SeiProcessor();
29
+
30
+ /** @private {?shaka.util.TsParser} */
31
+ this.tsParser_ = null;
29
32
  }
30
33
 
31
34
  /**
@@ -41,6 +44,12 @@ shaka.cea.TsCeaParser = class {
41
44
  parse(mediaSegment) {
42
45
  const CeaUtils = shaka.cea.CeaUtils;
43
46
 
47
+ if (!this.tsParser_) {
48
+ this.tsParser_ = new shaka.util.TsParser();
49
+ } else {
50
+ this.tsParser_.clearData();
51
+ }
52
+
44
53
  /** @type {!Array<!shaka.extern.ICeaParser.CaptionPacket>} **/
45
54
  const captionPackets = [];
46
55
 
@@ -48,7 +57,7 @@ shaka.cea.TsCeaParser = class {
48
57
  if (!shaka.util.TsParser.probe(uint8ArrayData)) {
49
58
  return captionPackets;
50
59
  }
51
- const tsParser = new shaka.util.TsParser().parse(uint8ArrayData);
60
+ const tsParser = this.tsParser_.parse(uint8ArrayData);
52
61
  const codecs = tsParser.getCodecs();
53
62
  const videoNalus = tsParser.getVideoNalus();
54
63
  const validNaluTypes = [];
@@ -643,6 +643,9 @@ shaka.dash.DashParser = class {
643
643
  // best latency
644
644
  if (this.lowLatencyMode_) {
645
645
  minBufferTime = 0;
646
+ const presentationDelay = suggestedPresentationDelay != null ?
647
+ suggestedPresentationDelay : this.config_.defaultPresentationDelay;
648
+ presentationTimeline.setDelay(presentationDelay);
646
649
  }
647
650
 
648
651
  // These steps are not done on manifest update.
@@ -1482,8 +1485,13 @@ shaka.dash.DashParser = class {
1482
1485
  const getBaseUris = context.representation.getBaseUris;
1483
1486
  streamInfo = {
1484
1487
  generateSegmentIndex: () => {
1485
- return Promise.resolve(shaka.media.SegmentIndex.forSingleSegment(
1486
- periodStart, duration, getBaseUris()));
1488
+ const segmentIndex = shaka.media.SegmentIndex.forSingleSegment(
1489
+ periodStart, duration, getBaseUris());
1490
+ segmentIndex.forEachTopLevelReference((ref) => {
1491
+ ref.mimeType = context.representation.mimeType;
1492
+ ref.codecs = context.representation.codecs;
1493
+ });
1494
+ return Promise.resolve(segmentIndex);
1487
1495
  },
1488
1496
  };
1489
1497
  }
@@ -1582,7 +1590,7 @@ shaka.dash.DashParser = class {
1582
1590
  },
1583
1591
  segmentIndex: null,
1584
1592
  mimeType: context.representation.mimeType,
1585
- codecs: context.representation.codecs,
1593
+ codecs,
1586
1594
  frameRate: context.representation.frameRate,
1587
1595
  pixelAspectRatio: context.representation.pixelAspectRatio,
1588
1596
  bandwidth: context.bandwidth,
@@ -1612,6 +1620,8 @@ shaka.dash.DashParser = class {
1612
1620
  accessibilityPurpose,
1613
1621
  external: false,
1614
1622
  fastSwitching: false,
1623
+ fullMimeTypes: new Set([shaka.util.MimeUtils.getFullType(
1624
+ context.representation.mimeType, context.representation.codecs)]),
1615
1625
  };
1616
1626
  }
1617
1627
 
@@ -62,7 +62,7 @@ shaka.dash.SegmentBase = class {
62
62
 
63
63
  const getUris = () => resolvedUris;
64
64
  const qualityInfo = shaka.dash.SegmentBase.createQualityInfo(context);
65
- return new shaka.media.InitSegmentReference(
65
+ const ref = new shaka.media.InitSegmentReference(
66
66
  getUris,
67
67
  startByte,
68
68
  endByte,
@@ -70,6 +70,9 @@ shaka.dash.SegmentBase = class {
70
70
  /* timescale= */ null,
71
71
  /* segmentData= */ null,
72
72
  aes128Key);
73
+ ref.codecs = context.representation.codecs;
74
+ ref.mimeType = context.representation.mimeType;
75
+ return ref;
73
76
  }
74
77
 
75
78
  /**
@@ -184,6 +187,10 @@ shaka.dash.SegmentBase = class {
184
187
  indexData, initData, uris, initSegmentReference, timestampOffset,
185
188
  appendWindowStart, appendWindowEnd);
186
189
  }
190
+ for (const ref of references) {
191
+ ref.codecs = context.representation.codecs;
192
+ ref.mimeType = context.representation.mimeType;
193
+ }
187
194
 
188
195
  presentationTimeline.notifySegments(references);
189
196
 
@@ -60,7 +60,8 @@ shaka.dash.SegmentList = class {
60
60
  const references = SegmentList.createSegmentReferences_(
61
61
  context.periodInfo.start, context.periodInfo.duration,
62
62
  info.startNumber, context.representation.getBaseUris, info,
63
- initSegmentReference, aes128Key);
63
+ initSegmentReference, aes128Key, context.representation.mimeType,
64
+ context.representation.codecs);
64
65
 
65
66
  const isNew = !segmentIndex;
66
67
  if (segmentIndex) {
@@ -199,12 +200,14 @@ shaka.dash.SegmentList = class {
199
200
  * @param {shaka.dash.SegmentList.SegmentListInfo} info
200
201
  * @param {shaka.media.InitSegmentReference} initSegmentReference
201
202
  * @param {shaka.extern.aes128Key|undefined} aes128Key
203
+ * @param {string} mimeType
204
+ * @param {string} codecs
202
205
  * @return {!Array.<!shaka.media.SegmentReference>}
203
206
  * @private
204
207
  */
205
208
  static createSegmentReferences_(
206
209
  periodStart, periodDuration, startNumber, getBaseUris, info,
207
- initSegmentReference, aes128Key) {
210
+ initSegmentReference, aes128Key, mimeType, codecs) {
208
211
  const ManifestParserUtils = shaka.util.ManifestParserUtils;
209
212
 
210
213
  let max = info.mediaSegments.length;
@@ -251,22 +254,25 @@ shaka.dash.SegmentList = class {
251
254
  }
252
255
  return uris;
253
256
  };
254
- references.push(
255
- new shaka.media.SegmentReference(
256
- periodStart + startTime,
257
- periodStart + endTime,
258
- getUris,
259
- segment.start,
260
- segment.end,
261
- initSegmentReference,
262
- timestampOffset,
263
- appendWindowStart, appendWindowEnd,
264
- /* partialReferences= */ [],
265
- /* tilesLayout= */ '',
266
- /* tileDuration= */ null,
267
- /* syncTime= */ null,
268
- shaka.media.SegmentReference.Status.AVAILABLE,
269
- aes128Key));
257
+
258
+ const ref = new shaka.media.SegmentReference(
259
+ periodStart + startTime,
260
+ periodStart + endTime,
261
+ getUris,
262
+ segment.start,
263
+ segment.end,
264
+ initSegmentReference,
265
+ timestampOffset,
266
+ appendWindowStart, appendWindowEnd,
267
+ /* partialReferences= */ [],
268
+ /* tilesLayout= */ '',
269
+ /* tileDuration= */ null,
270
+ /* syncTime= */ null,
271
+ shaka.media.SegmentReference.Status.AVAILABLE,
272
+ aes128Key);
273
+ ref.codecs = codecs;
274
+ ref.mimeType = mimeType;
275
+ references.push(ref);
270
276
  prevEndTime = endTime;
271
277
  }
272
278
 
@@ -213,6 +213,8 @@ shaka.dash.SegmentTemplate = class {
213
213
  timeline: segmentInfo.timeline,
214
214
  mediaTemplate: media,
215
215
  indexTemplate: index,
216
+ mimeType: context.representation.mimeType,
217
+ codecs: context.representation.codecs,
216
218
  };
217
219
  }
218
220
 
@@ -463,6 +465,8 @@ shaka.dash.SegmentTemplate = class {
463
465
  /* syncTime= */ null,
464
466
  shaka.media.SegmentReference.Status.AVAILABLE,
465
467
  aes128Key);
468
+ ref.codecs = context.representation.codecs;
469
+ ref.mimeType = context.representation.mimeType;
466
470
  // This is necessary information for thumbnail streams:
467
471
  ref.trueEndTime = trueSegmentEnd;
468
472
  return ref;
@@ -552,7 +556,7 @@ shaka.dash.SegmentTemplate = class {
552
556
  return resolvedUris;
553
557
  };
554
558
  const qualityInfo = shaka.dash.SegmentBase.createQualityInfo(context);
555
- return new shaka.media.InitSegmentReference(
559
+ const ref = new shaka.media.InitSegmentReference(
556
560
  getUris,
557
561
  /* startByte= */ 0,
558
562
  /* endByte= */ null,
@@ -560,6 +564,9 @@ shaka.dash.SegmentTemplate = class {
560
564
  /* timescale= */ null,
561
565
  /* segmentData= */ null,
562
566
  aes128Key);
567
+ ref.codecs = context.representation.codecs;
568
+ ref.mimeType = context.representation.mimeType;
569
+ return ref;
563
570
  }
564
571
  };
565
572
 
@@ -835,6 +842,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
835
842
  this.periodEnd_ !== Infinity) {
836
843
  segmentEnd = this.periodEnd_;
837
844
  }
845
+ const codecs = this.templateInfo_.codecs;
846
+ const mimeType = this.templateInfo_.mimeType;
838
847
 
839
848
  const partialSegmentRefs = [];
840
849
 
@@ -877,6 +886,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
877
886
  /* syncTime= */ null,
878
887
  shaka.media.SegmentReference.Status.AVAILABLE,
879
888
  this.aes128Key_);
889
+ partial.codecs = codecs;
890
+ partial.mimeType = mimeType;
880
891
  if (this.segmentSequenceCadence_ == 0) {
881
892
  if (i > 0) {
882
893
  partial.markAsNonIndependent();
@@ -920,6 +931,8 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
920
931
  shaka.media.SegmentReference.Status.AVAILABLE,
921
932
  this.aes128Key_,
922
933
  /* allPartialSegments= */ range.partialSegments > 0);
934
+ ref.codecs = codecs;
935
+ ref.mimeType = mimeType;
923
936
  ref.trueEndTime = trueSegmentEnd;
924
937
  this.references[correctedPosition] = ref;
925
938
  }
@@ -955,7 +968,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
955
968
  * unscaledPresentationTimeOffset: number,
956
969
  * timeline: Array.<shaka.media.PresentationTimeline.TimeRange>,
957
970
  * mediaTemplate: ?string,
958
- * indexTemplate: ?string
971
+ * indexTemplate: ?string,
972
+ * mimeType: string,
973
+ * codecs: string
959
974
  * }}
960
975
  *
961
976
  * @description
@@ -977,5 +992,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
977
992
  * The media URI template, if given.
978
993
  * @property {?string} indexTemplate
979
994
  * The index URI template, if given.
995
+ * @property {string} mimeType
996
+ * The mimeType.
997
+ * @property {string} codecs
998
+ * The codecs.
980
999
  */
981
1000
  shaka.dash.SegmentTemplate.SegmentTemplateInfo;