shaka-player 4.9.0 → 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.
Files changed (33) hide show
  1. package/dist/locales.js +34 -34
  2. package/dist/shaka-player.compiled.d.ts +0 -1
  3. package/dist/shaka-player.compiled.debug.d.ts +0 -1
  4. package/dist/shaka-player.compiled.debug.externs.js +0 -1
  5. package/dist/shaka-player.compiled.debug.js +184 -183
  6. package/dist/shaka-player.compiled.debug.map +2 -2
  7. package/dist/shaka-player.compiled.externs.js +0 -1
  8. package/dist/shaka-player.compiled.js +287 -286
  9. package/dist/shaka-player.compiled.map +2 -2
  10. package/dist/shaka-player.ui.d.ts +0 -1
  11. package/dist/shaka-player.ui.debug.d.ts +0 -1
  12. package/dist/shaka-player.ui.debug.externs.js +0 -1
  13. package/dist/shaka-player.ui.debug.js +94 -92
  14. package/dist/shaka-player.ui.debug.map +3 -3
  15. package/dist/shaka-player.ui.externs.js +0 -1
  16. package/dist/shaka-player.ui.js +552 -551
  17. package/dist/shaka-player.ui.map +3 -3
  18. package/lib/media/content_workarounds.js +4 -2
  19. package/lib/media/media_source_engine.js +66 -31
  20. package/lib/player.js +5 -5
  21. package/lib/transmuxer/aac_transmuxer.js +4 -2
  22. package/lib/transmuxer/ac3_transmuxer.js +2 -1
  23. package/lib/transmuxer/ec3_transmuxer.js +2 -1
  24. package/lib/transmuxer/mp3_transmuxer.js +4 -2
  25. package/lib/transmuxer/mpeg_ts_transmuxer.js +2 -1
  26. package/lib/transmuxer/mss_transmuxer.js +4 -2
  27. package/lib/transmuxer/ts_transmuxer.js +44 -24
  28. package/lib/util/error.js +10 -8
  29. package/lib/util/object_utils.js +1 -2
  30. package/package.json +1 -1
  31. package/ui/audio_language_selection.js +4 -0
  32. package/ui/resolution_selection.js +4 -0
  33. package/ui/text_selection.js +4 -0
@@ -30,10 +30,11 @@ shaka.media.ContentWorkarounds = class {
30
30
  * need this workaround.
31
31
  *
32
32
  * @param {!BufferSource} initSegmentBuffer
33
+ * @param {?string} uri
33
34
  * @return {!Uint8Array}
34
35
  * @see https://github.com/shaka-project/shaka-player/issues/2759
35
36
  */
36
- static fakeEncryption(initSegmentBuffer) {
37
+ static fakeEncryption(initSegmentBuffer, uri) {
37
38
  const ContentWorkarounds = shaka.media.ContentWorkarounds;
38
39
  let initSegment = shaka.util.BufferUtils.toUint8(initSegmentBuffer);
39
40
  let isEncrypted = false;
@@ -154,7 +155,8 @@ shaka.media.ContentWorkarounds = class {
154
155
  throw new shaka.util.Error(
155
156
  shaka.util.Error.Severity.CRITICAL,
156
157
  shaka.util.Error.Category.MEDIA,
157
- shaka.util.Error.Code.CONTENT_TRANSFORMATION_FAILED);
158
+ shaka.util.Error.Code.CONTENT_TRANSFORMATION_FAILED,
159
+ uri);
158
160
  }
159
161
 
160
162
  // Modify boxes in order from largest offset to smallest, so that earlier
@@ -569,7 +569,8 @@ shaka.media.MediaSourceEngine = class {
569
569
  shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
570
570
  exception,
571
571
  'The mediaSource_ status was ' + this.mediaSource_.readyState +
572
- ' expected \'open\'');
572
+ ' expected \'open\'',
573
+ null);
573
574
  }
574
575
 
575
576
  if (this.sequenceMode_) {
@@ -935,10 +936,12 @@ shaka.media.MediaSourceEngine = class {
935
936
  if (this.attemptTimestampOffsetCalculation_) {
936
937
  this.enqueueOperation_(
937
938
  contentType,
938
- () => this.abort_(contentType));
939
+ () => this.abort_(contentType),
940
+ null);
939
941
  this.enqueueOperation_(
940
942
  contentType,
941
- () => this.setTimestampOffset_(contentType, timestampOffset));
943
+ () => this.setTimestampOffset_(contentType, timestampOffset),
944
+ null);
942
945
  }
943
946
  }
944
947
  // Timestamps can only be reliably extracted from video, not audio.
@@ -983,7 +986,8 @@ shaka.media.MediaSourceEngine = class {
983
986
  }
984
987
 
985
988
  data = this.workAroundBrokenPlatforms_(
986
- data, reference ? reference.startTime : null, contentType);
989
+ data, reference ? reference.startTime : null, contentType,
990
+ reference ? reference.getUris()[0] : null);
987
991
 
988
992
  if (reference && this.sequenceMode_ && contentType != ContentType.TEXT) {
989
993
  // In sequence mode, for non-text streams, if we just cleared the buffer
@@ -995,10 +999,14 @@ shaka.media.MediaSourceEngine = class {
995
999
  // extended during unbuffered seeks or automatic adaptations; it is
996
1000
  // possible for the append state to be PARSING_MEDIA_SEGMENT from the
997
1001
  // previous SourceBuffer#appendBuffer() call.
998
- this.enqueueOperation_(contentType, () => this.abort_(contentType));
999
1002
  this.enqueueOperation_(
1000
1003
  contentType,
1001
- () => this.setTimestampOffset_(contentType, timestampOffset));
1004
+ () => this.abort_(contentType),
1005
+ null);
1006
+ this.enqueueOperation_(
1007
+ contentType,
1008
+ () => this.setTimestampOffset_(contentType, timestampOffset),
1009
+ null);
1002
1010
  }
1003
1011
  }
1004
1012
 
@@ -1009,7 +1017,7 @@ shaka.media.MediaSourceEngine = class {
1009
1017
  bufferedBefore = this.getBuffered_(contentType);
1010
1018
  }
1011
1019
  this.append_(contentType, data, timestampOffset);
1012
- });
1020
+ }, reference ? reference.getUris()[0] : null);
1013
1021
 
1014
1022
  if (goog.DEBUG && reference && !reference.isPreload() && !isChunkedData) {
1015
1023
  const bufferedAfter = this.getBuffered_(contentType);
@@ -1067,11 +1075,13 @@ shaka.media.MediaSourceEngine = class {
1067
1075
  } else {
1068
1076
  await this.enqueueOperation_(
1069
1077
  contentType,
1070
- () => this.remove_(contentType, startTime, endTime));
1078
+ () => this.remove_(contentType, startTime, endTime),
1079
+ null);
1071
1080
  if (this.needSplitMuxedContent_) {
1072
1081
  await this.enqueueOperation_(
1073
1082
  ContentType.AUDIO,
1074
- () => this.remove_(ContentType.AUDIO, startTime, endTime));
1083
+ () => this.remove_(ContentType.AUDIO, startTime, endTime),
1084
+ null);
1075
1085
  }
1076
1086
  }
1077
1087
  }
@@ -1093,12 +1103,14 @@ shaka.media.MediaSourceEngine = class {
1093
1103
  // Note that not all platforms allow clearing to Infinity.
1094
1104
  await this.enqueueOperation_(
1095
1105
  contentType,
1096
- () => this.remove_(contentType, 0, this.mediaSource_.duration));
1106
+ () => this.remove_(contentType, 0, this.mediaSource_.duration),
1107
+ null);
1097
1108
  if (this.needSplitMuxedContent_) {
1098
1109
  await this.enqueueOperation_(
1099
1110
  ContentType.AUDIO,
1100
1111
  () => this.remove_(
1101
- ContentType.AUDIO, 0, this.mediaSource_.duration));
1112
+ ContentType.AUDIO, 0, this.mediaSource_.duration),
1113
+ null);
1102
1114
  }
1103
1115
  }
1104
1116
  }
@@ -1129,11 +1141,13 @@ shaka.media.MediaSourceEngine = class {
1129
1141
  }
1130
1142
  await this.enqueueOperation_(
1131
1143
  contentType,
1132
- () => this.flush_(contentType));
1144
+ () => this.flush_(contentType),
1145
+ null);
1133
1146
  if (this.needSplitMuxedContent_) {
1134
1147
  await this.enqueueOperation_(
1135
1148
  ContentType.AUDIO,
1136
- () => this.flush_(ContentType.AUDIO));
1149
+ () => this.flush_(ContentType.AUDIO),
1150
+ null);
1137
1151
  }
1138
1152
  }
1139
1153
 
@@ -1188,33 +1202,39 @@ shaka.media.MediaSourceEngine = class {
1188
1202
  // set it.
1189
1203
  operations.push(this.enqueueOperation_(
1190
1204
  contentType,
1191
- () => this.abort_(contentType)));
1205
+ () => this.abort_(contentType),
1206
+ null));
1192
1207
  if (this.needSplitMuxedContent_) {
1193
1208
  operations.push(this.enqueueOperation_(
1194
1209
  ContentType.AUDIO,
1195
- () => this.abort_(ContentType.AUDIO)));
1210
+ () => this.abort_(ContentType.AUDIO),
1211
+ null));
1196
1212
  }
1197
1213
  }
1198
1214
  if (!ignoreTimestampOffset) {
1199
1215
  operations.push(this.enqueueOperation_(
1200
1216
  contentType,
1201
- () => this.setTimestampOffset_(contentType, timestampOffset)));
1217
+ () => this.setTimestampOffset_(contentType, timestampOffset),
1218
+ null));
1202
1219
  if (this.needSplitMuxedContent_) {
1203
1220
  operations.push(this.enqueueOperation_(
1204
1221
  ContentType.AUDIO,
1205
1222
  () => this.setTimestampOffset_(
1206
- ContentType.AUDIO, timestampOffset)));
1223
+ ContentType.AUDIO, timestampOffset),
1224
+ null));
1207
1225
  }
1208
1226
  }
1209
1227
  operations.push(this.enqueueOperation_(
1210
1228
  contentType,
1211
1229
  () => this.setAppendWindow_(
1212
- contentType, appendWindowStart, appendWindowEnd)));
1230
+ contentType, appendWindowStart, appendWindowEnd),
1231
+ null));
1213
1232
  if (this.needSplitMuxedContent_) {
1214
1233
  operations.push(this.enqueueOperation_(
1215
1234
  ContentType.AUDIO,
1216
1235
  () => this.setAppendWindow_(
1217
- ContentType.AUDIO, appendWindowStart, appendWindowEnd)));
1236
+ ContentType.AUDIO, appendWindowStart, appendWindowEnd),
1237
+ null));
1218
1238
  }
1219
1239
 
1220
1240
  await Promise.all(operations);
@@ -1251,19 +1271,23 @@ shaka.media.MediaSourceEngine = class {
1251
1271
  // set it.
1252
1272
  this.enqueueOperation_(
1253
1273
  contentType,
1254
- () => this.abort_(contentType));
1274
+ () => this.abort_(contentType),
1275
+ null);
1255
1276
  if (this.needSplitMuxedContent_) {
1256
1277
  this.enqueueOperation_(
1257
1278
  ContentType.AUDIO,
1258
- () => this.abort_(ContentType.AUDIO));
1279
+ () => this.abort_(ContentType.AUDIO),
1280
+ null);
1259
1281
  }
1260
1282
  await this.enqueueOperation_(
1261
1283
  contentType,
1262
- () => this.setTimestampOffset_(contentType, timestampOffset));
1284
+ () => this.setTimestampOffset_(contentType, timestampOffset),
1285
+ null);
1263
1286
  if (this.needSplitMuxedContent_) {
1264
1287
  await this.enqueueOperation_(
1265
1288
  ContentType.AUDIO,
1266
- () => this.setTimestampOffset_(ContentType.AUDIO, timestampOffset));
1289
+ () => this.setTimestampOffset_(ContentType.AUDIO, timestampOffset),
1290
+ null);
1267
1291
  }
1268
1292
  }
1269
1293
 
@@ -1306,6 +1330,7 @@ shaka.media.MediaSourceEngine = class {
1306
1330
  const dummyOperation = {
1307
1331
  start: () => {},
1308
1332
  p: new shaka.util.PublicPromise(),
1333
+ uri: null,
1309
1334
  };
1310
1335
  this.queues_[contentType].unshift(dummyOperation);
1311
1336
  }
@@ -1465,7 +1490,7 @@ shaka.media.MediaSourceEngine = class {
1465
1490
  shaka.util.Error.Severity.CRITICAL,
1466
1491
  shaka.util.Error.Category.MEDIA,
1467
1492
  shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_FAILED,
1468
- code));
1493
+ code, operation.uri));
1469
1494
  // Do not pop from queue. An 'updateend' event will fire next, and to
1470
1495
  // avoid synchronizing these two event handlers, we will allow that one to
1471
1496
  // pop from the queue as normal. Note that because the operation has
@@ -1497,14 +1522,16 @@ shaka.media.MediaSourceEngine = class {
1497
1522
  *
1498
1523
  * @param {shaka.util.ManifestParserUtils.ContentType} contentType
1499
1524
  * @param {function()} start
1525
+ * @param {?string} uri
1500
1526
  * @return {!Promise}
1501
1527
  * @private
1502
1528
  */
1503
- enqueueOperation_(contentType, start) {
1529
+ enqueueOperation_(contentType, start, uri) {
1504
1530
  this.destroyer_.ensureNotDestroyed();
1505
1531
  const operation = {
1506
1532
  start: start,
1507
1533
  p: new shaka.util.PublicPromise(),
1534
+ uri,
1508
1535
  };
1509
1536
  this.queues_[contentType].push(operation);
1510
1537
 
@@ -1536,6 +1563,7 @@ shaka.media.MediaSourceEngine = class {
1536
1563
  const operation = {
1537
1564
  start: () => ready.resolve(),
1538
1565
  p: ready,
1566
+ uri: null,
1539
1567
  };
1540
1568
 
1541
1569
  this.queues_[contentType].push(operation);
@@ -1593,7 +1621,8 @@ shaka.media.MediaSourceEngine = class {
1593
1621
  shaka.util.Error.Category.MEDIA,
1594
1622
  shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
1595
1623
  exception,
1596
- this.video_.error || 'No error in the media element');
1624
+ this.video_.error || 'No error in the media element',
1625
+ null);
1597
1626
  } finally {
1598
1627
  // Unblock the queues.
1599
1628
  for (const contentType in this.sourceBuffers_) {
@@ -1637,7 +1666,8 @@ shaka.media.MediaSourceEngine = class {
1637
1666
  shaka.util.Error.Category.MEDIA,
1638
1667
  shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
1639
1668
  exception,
1640
- this.video_.error || 'No error in the media element'));
1669
+ this.video_.error || 'No error in the media element',
1670
+ next.uri));
1641
1671
  }
1642
1672
  this.popFromQueue_(contentType);
1643
1673
  }
@@ -1684,10 +1714,11 @@ shaka.media.MediaSourceEngine = class {
1684
1714
  * @param {!BufferSource} segment
1685
1715
  * @param {?number} startTime
1686
1716
  * @param {shaka.util.ManifestParserUtils.ContentType} contentType
1717
+ * @param {?string} uri
1687
1718
  * @return {!BufferSource}
1688
1719
  * @private
1689
1720
  */
1690
- workAroundBrokenPlatforms_(segment, startTime, contentType) {
1721
+ workAroundBrokenPlatforms_(segment, startTime, contentType, uri) {
1691
1722
  const isInitSegment = startTime == null;
1692
1723
  const encryptionExpected = this.expectedEncryption_[contentType];
1693
1724
 
@@ -1708,7 +1739,7 @@ shaka.media.MediaSourceEngine = class {
1708
1739
  shaka.util.MimeUtils.getContainerType(
1709
1740
  this.sourceBufferTypes_[contentType]) == 'mp4') {
1710
1741
  shaka.log.debug('Forcing fake encryption information in init segment.');
1711
- segment = shaka.media.ContentWorkarounds.fakeEncryption(segment);
1742
+ segment = shaka.media.ContentWorkarounds.fakeEncryption(segment, uri);
1712
1743
  }
1713
1744
 
1714
1745
  return segment;
@@ -1761,7 +1792,8 @@ shaka.media.MediaSourceEngine = class {
1761
1792
  changeType(contentType, mimeType, transmuxer) {
1762
1793
  return this.enqueueOperation_(
1763
1794
  contentType,
1764
- () => this.change_(contentType, mimeType, transmuxer));
1795
+ () => this.change_(contentType, mimeType, transmuxer),
1796
+ null);
1765
1797
  }
1766
1798
 
1767
1799
  /**
@@ -2096,7 +2128,8 @@ shaka.media.MediaSourceEngine.createObjectURL = window.URL.createObjectURL;
2096
2128
  /**
2097
2129
  * @typedef {{
2098
2130
  * start: function(),
2099
- * p: !shaka.util.PublicPromise
2131
+ * p: !shaka.util.PublicPromise,
2132
+ * uri: ?string
2100
2133
  * }}
2101
2134
  *
2102
2135
  * @summary An operation in queue.
@@ -2104,6 +2137,8 @@ shaka.media.MediaSourceEngine.createObjectURL = window.URL.createObjectURL;
2104
2137
  * The function which starts the operation.
2105
2138
  * @property {!shaka.util.PublicPromise} p
2106
2139
  * The PublicPromise which is associated with this operation.
2140
+ * @property {?string} uri
2141
+ * A segment URI (if any) associated with this operation.
2107
2142
  */
2108
2143
  shaka.media.MediaSourceEngine.Operation;
2109
2144
 
package/lib/player.js CHANGED
@@ -2405,7 +2405,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2405
2405
  const setupPlayhead = (startTime) => {
2406
2406
  this.playhead_ = this.createPlayhead(startTime);
2407
2407
  this.playheadObservers_ =
2408
- this.createPlayheadObserversForMSE_(startTimeOfLoad);
2408
+ this.createPlayheadObserversForMSE_(startTime);
2409
2409
 
2410
2410
  // We need to start the buffer management code near the end because it
2411
2411
  // will set the initial buffering state and that depends on other
@@ -3242,16 +3242,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
3242
3242
  * Create the observers for MSE playback. These observers are responsible for
3243
3243
  * notifying the app and player of specific events during MSE playback.
3244
3244
  *
3245
- * @param {number} startTimeOfLoad
3245
+ * @param {number} startTime
3246
3246
  * @return {!shaka.media.PlayheadObserverManager}
3247
3247
  * @private
3248
3248
  */
3249
- createPlayheadObserversForMSE_(startTimeOfLoad) {
3249
+ createPlayheadObserversForMSE_(startTime) {
3250
3250
  goog.asserts.assert(this.manifest_, 'Must have manifest');
3251
3251
  goog.asserts.assert(this.regionTimeline_, 'Must have region timeline');
3252
3252
  goog.asserts.assert(this.video_, 'Must have video element');
3253
3253
 
3254
- const startsPastZero = this.isLive() || startTimeOfLoad > 0;
3254
+ const startsPastZero = this.isLive() || startTime > 0;
3255
3255
 
3256
3256
  // Create the region observer. This will allow us to notify the app when we
3257
3257
  // move in and out of timeline regions.
@@ -7446,7 +7446,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7446
7446
  * @export
7447
7447
  */
7448
7448
  // eslint-disable-next-line no-useless-concat
7449
- shaka.Player.version = 'v4.9.0' + '-uncompiled'; // x-release-please-version
7449
+ shaka.Player.version = 'v4.9.1' + '-uncompiled'; // x-release-please-version
7450
7450
 
7451
7451
  // Initialize the deprecation system using the version string we just set
7452
7452
  // on the player.
@@ -141,7 +141,8 @@ shaka.transmuxer.AacTransmuxer = class {
141
141
  return Promise.reject(new shaka.util.Error(
142
142
  shaka.util.Error.Severity.CRITICAL,
143
143
  shaka.util.Error.Category.MEDIA,
144
- shaka.util.Error.Code.TRANSMUXING_FAILED));
144
+ shaka.util.Error.Code.TRANSMUXING_FAILED,
145
+ reference ? reference.getUris()[0] : null));
145
146
  }
146
147
  stream.audioSamplingRate = info.sampleRate;
147
148
  stream.channelsCount = info.channelCount;
@@ -155,7 +156,8 @@ shaka.transmuxer.AacTransmuxer = 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
  const length = header.headerLength + header.frameLength;
161
163
  if (offset + length <= uint8ArrayData.length) {
@@ -144,7 +144,8 @@ shaka.transmuxer.Ac3Transmuxer = 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;
@@ -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;