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.js CHANGED
@@ -1073,7 +1073,7 @@
1073
1073
  // Some browsers don't allow to use bind on console object anyway
1074
1074
  // fallback to default if needed
1075
1075
  try {
1076
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-rc.1.0.canary.11076");
1076
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-rc.1.0.canary.11078");
1077
1077
  } catch (e) {
1078
1078
  /* log fn threw an exception. All logger methods are no-ops. */
1079
1079
  return createLogger();
@@ -1845,16 +1845,27 @@
1845
1845
  }[hdlrType];
1846
1846
  if (type) {
1847
1847
  // Parse codec details
1848
- var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1849
- var stsdData = parseStsd(stsd);
1850
- result[trackId] = {
1851
- timescale: timescale,
1852
- type: type
1853
- };
1854
- result[type] = _objectSpread2({
1855
- timescale: timescale,
1856
- id: trackId
1857
- }, stsdData);
1848
+ var stsdBox = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1849
+ var stsd = parseStsd(stsdBox);
1850
+ if (type) {
1851
+ // Add 'audio', 'video', and 'audiovideo' track records that will map to SourceBuffers
1852
+ result[trackId] = {
1853
+ timescale: timescale,
1854
+ type: type,
1855
+ stsd: stsd
1856
+ };
1857
+ result[type] = _objectSpread2({
1858
+ timescale: timescale,
1859
+ id: trackId
1860
+ }, stsd);
1861
+ } else {
1862
+ // Add 'meta' and other track records required by `offsetStartDTS`
1863
+ result[trackId] = {
1864
+ timescale: timescale,
1865
+ type: hdlrType,
1866
+ stsd: stsd
1867
+ };
1868
+ }
1858
1869
  }
1859
1870
  }
1860
1871
  }
@@ -2306,6 +2317,8 @@
2306
2317
  }
2307
2318
  return duration;
2308
2319
  }
2320
+
2321
+ // TODO: Remove `offsetStartDTS` in favor of using `timestampOffset` (issue #5715)
2309
2322
  function offsetStartDTS(initData, fmp4, timeOffset) {
2310
2323
  findBox(fmp4, ['moof', 'traf']).forEach(function (traf) {
2311
2324
  findBox(traf, ['tfhd']).forEach(function (tfhd) {
@@ -3007,6 +3020,21 @@
3007
3020
  return getCodecCompatibleNameLower(m.toLowerCase(), preferManagedMediaSource);
3008
3021
  });
3009
3022
  }
3023
+ function replaceVideoCodec(originalCodecs, newVideoCodec) {
3024
+ var codecs = [];
3025
+ if (originalCodecs) {
3026
+ var allCodecs = originalCodecs.split(',');
3027
+ for (var i = 0; i < allCodecs.length; i++) {
3028
+ if (!isCodecType(allCodecs[i], 'video')) {
3029
+ codecs.push(allCodecs[i]);
3030
+ }
3031
+ }
3032
+ }
3033
+ if (newVideoCodec) {
3034
+ codecs.push(newVideoCodec);
3035
+ }
3036
+ return codecs.join(',');
3037
+ }
3010
3038
  function pickMostCompleteCodecName(parsedCodec, levelCodec) {
3011
3039
  // Parsing of mp4a codecs strings in mp4-tools from media is incomplete as of d8c6c7a
3012
3040
  // so use level codec is parsed codec is unavailable or incomplete
@@ -15847,6 +15875,7 @@
15847
15875
  tracks.audiovideo = {
15848
15876
  container: 'video/mp4',
15849
15877
  codec: audioCodec + ',' + videoCodec,
15878
+ supplemental: initData.video.supplemental,
15850
15879
  initSegment: initSegment,
15851
15880
  id: 'main'
15852
15881
  };
@@ -16531,7 +16560,7 @@
16531
16560
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16532
16561
  }
16533
16562
 
16534
- var version = "1.6.0-rc.1.0.canary.11076";
16563
+ var version = "1.6.0-rc.1.0.canary.11078";
16535
16564
 
16536
16565
  // ensure the worker ends up in the bundle
16537
16566
  // If the worker should not be included this gets aliased to empty.js
@@ -19672,10 +19701,11 @@
19672
19701
  _proto.getTrackCodec = function getTrackCodec(track, trackName) {
19673
19702
  // Use supplemental video codec when supported when adding SourceBuffer (#5558)
19674
19703
  var supplementalCodec = track.supplemental;
19675
- if (supplementalCodec && trackName === 'video' && areCodecsMediaSourceSupported(supplementalCodec, trackName)) {
19676
- return supplementalCodec;
19704
+ var trackCodec = track.codec;
19705
+ if (supplementalCodec && (trackName === 'video' || trackName === 'audiovideo') && areCodecsMediaSourceSupported(supplementalCodec, 'video')) {
19706
+ trackCodec = replaceVideoCodec(trackCodec, supplementalCodec);
19677
19707
  }
19678
- var codec = pickMostCompleteCodecName(track.codec, track.levelCodec);
19708
+ var codec = pickMostCompleteCodecName(trackCodec, track.levelCodec);
19679
19709
  if (codec) {
19680
19710
  if (trackName.slice(0, 5) === 'audio') {
19681
19711
  return getCodecCompatibleName(codec, this.appendSource);