hls.js 1.6.0-rc.1.0.canary.11076 → 1.6.0-rc.1.0.canary.11078

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/dist/hls.mjs CHANGED
@@ -402,7 +402,7 @@ function enableLogs(debugConfig, context, id) {
402
402
  // Some browsers don't allow to use bind on console object anyway
403
403
  // fallback to default if needed
404
404
  try {
405
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-rc.1.0.canary.11076"}`);
405
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-rc.1.0.canary.11078"}`);
406
406
  } catch (e) {
407
407
  /* log fn threw an exception. All logger methods are no-ops. */
408
408
  return createLogger();
@@ -1310,16 +1310,27 @@ function parseInitSegment(initSegment) {
1310
1310
  }[hdlrType];
1311
1311
  if (type) {
1312
1312
  // Parse codec details
1313
- const stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1314
- const stsdData = parseStsd(stsd);
1315
- result[trackId] = {
1316
- timescale,
1317
- type
1318
- };
1319
- result[type] = _objectSpread2({
1320
- timescale,
1321
- id: trackId
1322
- }, stsdData);
1313
+ const stsdBox = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1314
+ const stsd = parseStsd(stsdBox);
1315
+ if (type) {
1316
+ // Add 'audio', 'video', and 'audiovideo' track records that will map to SourceBuffers
1317
+ result[trackId] = {
1318
+ timescale,
1319
+ type,
1320
+ stsd
1321
+ };
1322
+ result[type] = _objectSpread2({
1323
+ timescale,
1324
+ id: trackId
1325
+ }, stsd);
1326
+ } else {
1327
+ // Add 'meta' and other track records required by `offsetStartDTS`
1328
+ result[trackId] = {
1329
+ timescale,
1330
+ type: hdlrType,
1331
+ stsd
1332
+ };
1333
+ }
1323
1334
  }
1324
1335
  }
1325
1336
  }
@@ -1767,6 +1778,8 @@ function computeRawDurationFromSamples(trun) {
1767
1778
  }
1768
1779
  return duration;
1769
1780
  }
1781
+
1782
+ // TODO: Remove `offsetStartDTS` in favor of using `timestampOffset` (issue #5715)
1770
1783
  function offsetStartDTS(initData, fmp4, timeOffset) {
1771
1784
  findBox(fmp4, ['moof', 'traf']).forEach(traf => {
1772
1785
  findBox(traf, ['tfhd']).forEach(tfhd => {
@@ -2449,6 +2462,21 @@ const AUDIO_CODEC_REGEXP = /flac|opus|mp4a\.40\.34/i;
2449
2462
  function getCodecCompatibleName(codec, preferManagedMediaSource = true) {
2450
2463
  return codec.replace(AUDIO_CODEC_REGEXP, m => getCodecCompatibleNameLower(m.toLowerCase(), preferManagedMediaSource));
2451
2464
  }
2465
+ function replaceVideoCodec(originalCodecs, newVideoCodec) {
2466
+ const codecs = [];
2467
+ if (originalCodecs) {
2468
+ const allCodecs = originalCodecs.split(',');
2469
+ for (let i = 0; i < allCodecs.length; i++) {
2470
+ if (!isCodecType(allCodecs[i], 'video')) {
2471
+ codecs.push(allCodecs[i]);
2472
+ }
2473
+ }
2474
+ }
2475
+ if (newVideoCodec) {
2476
+ codecs.push(newVideoCodec);
2477
+ }
2478
+ return codecs.join(',');
2479
+ }
2452
2480
  function pickMostCompleteCodecName(parsedCodec, levelCodec) {
2453
2481
  // Parsing of mp4a codecs strings in mp4-tools from media is incomplete as of d8c6c7a
2454
2482
  // so use level codec is parsed codec is unavailable or incomplete
@@ -10058,7 +10086,7 @@ function requireEventemitter3 () {
10058
10086
  var eventemitter3Exports = requireEventemitter3();
10059
10087
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
10060
10088
 
10061
- const version = "1.6.0-rc.1.0.canary.11076";
10089
+ const version = "1.6.0-rc.1.0.canary.11078";
10062
10090
 
10063
10091
  // ensure the worker ends up in the bundle
10064
10092
  // If the worker should not be included this gets aliased to empty.js
@@ -15447,6 +15475,7 @@ class PassThroughRemuxer {
15447
15475
  tracks.audiovideo = {
15448
15476
  container: 'video/mp4',
15449
15477
  codec: audioCodec + ',' + videoCodec,
15478
+ supplemental: initData.video.supplemental,
15450
15479
  initSegment,
15451
15480
  id: 'main'
15452
15481
  };
@@ -19115,10 +19144,11 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
19115
19144
  getTrackCodec(track, trackName) {
19116
19145
  // Use supplemental video codec when supported when adding SourceBuffer (#5558)
19117
19146
  const supplementalCodec = track.supplemental;
19118
- if (supplementalCodec && trackName === 'video' && areCodecsMediaSourceSupported(supplementalCodec, trackName)) {
19119
- return supplementalCodec;
19147
+ let trackCodec = track.codec;
19148
+ if (supplementalCodec && (trackName === 'video' || trackName === 'audiovideo') && areCodecsMediaSourceSupported(supplementalCodec, 'video')) {
19149
+ trackCodec = replaceVideoCodec(trackCodec, supplementalCodec);
19120
19150
  }
19121
- const codec = pickMostCompleteCodecName(track.codec, track.levelCodec);
19151
+ const codec = pickMostCompleteCodecName(trackCodec, track.levelCodec);
19122
19152
  if (codec) {
19123
19153
  if (trackName.slice(0, 5) === 'audio') {
19124
19154
  return getCodecCompatibleName(codec, this.appendSource);