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.
@@ -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 => {
@@ -2346,6 +2359,21 @@ const AUDIO_CODEC_REGEXP = /flac|opus|mp4a\.40\.34/i;
2346
2359
  function getCodecCompatibleName(codec, preferManagedMediaSource = true) {
2347
2360
  return codec.replace(AUDIO_CODEC_REGEXP, m => getCodecCompatibleNameLower(m.toLowerCase(), preferManagedMediaSource));
2348
2361
  }
2362
+ function replaceVideoCodec(originalCodecs, newVideoCodec) {
2363
+ const codecs = [];
2364
+ if (originalCodecs) {
2365
+ const allCodecs = originalCodecs.split(',');
2366
+ for (let i = 0; i < allCodecs.length; i++) {
2367
+ if (!isCodecType(allCodecs[i], 'video')) {
2368
+ codecs.push(allCodecs[i]);
2369
+ }
2370
+ }
2371
+ }
2372
+ if (newVideoCodec) {
2373
+ codecs.push(newVideoCodec);
2374
+ }
2375
+ return codecs.join(',');
2376
+ }
2349
2377
  function pickMostCompleteCodecName(parsedCodec, levelCodec) {
2350
2378
  // Parsing of mp4a codecs strings in mp4-tools from media is incomplete as of d8c6c7a
2351
2379
  // so use level codec is parsed codec is unavailable or incomplete
@@ -10504,10 +10532,11 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
10504
10532
  getTrackCodec(track, trackName) {
10505
10533
  // Use supplemental video codec when supported when adding SourceBuffer (#5558)
10506
10534
  const supplementalCodec = track.supplemental;
10507
- if (supplementalCodec && trackName === 'video' && areCodecsMediaSourceSupported(supplementalCodec, trackName)) {
10508
- return supplementalCodec;
10535
+ let trackCodec = track.codec;
10536
+ if (supplementalCodec && (trackName === 'video' || trackName === 'audiovideo') && areCodecsMediaSourceSupported(supplementalCodec, 'video')) {
10537
+ trackCodec = replaceVideoCodec(trackCodec, supplementalCodec);
10509
10538
  }
10510
- const codec = pickMostCompleteCodecName(track.codec, track.levelCodec);
10539
+ const codec = pickMostCompleteCodecName(trackCodec, track.levelCodec);
10511
10540
  if (codec) {
10512
10541
  if (trackName.slice(0, 5) === 'audio') {
10513
10542
  return getCodecCompatibleName(codec, this.appendSource);
@@ -16339,6 +16368,7 @@ class PassThroughRemuxer {
16339
16368
  tracks.audiovideo = {
16340
16369
  container: 'video/mp4',
16341
16370
  codec: audioCodec + ',' + videoCodec,
16371
+ supplemental: initData.video.supplemental,
16342
16372
  initSegment,
16343
16373
  id: 'main'
16344
16374
  };
@@ -19607,7 +19637,7 @@ function assignTrackIdsByGroup(tracks) {
19607
19637
  });
19608
19638
  }
19609
19639
 
19610
- const version = "1.6.0-rc.1.0.canary.11076";
19640
+ const version = "1.6.0-rc.1.0.canary.11078";
19611
19641
 
19612
19642
  // ensure the worker ends up in the bundle
19613
19643
  // If the worker should not be included this gets aliased to empty.js