hls.js 1.6.0-beta.2.0.canary.10873 → 1.6.0-beta.2.0.canary.10877

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.light.js CHANGED
@@ -1029,7 +1029,7 @@
1029
1029
  // Some browsers don't allow to use bind on console object anyway
1030
1030
  // fallback to default if needed
1031
1031
  try {
1032
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10873");
1032
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10877");
1033
1033
  } catch (e) {
1034
1034
  /* log fn threw an exception. All logger methods are no-ops. */
1035
1035
  return createLogger();
@@ -12041,7 +12041,6 @@
12041
12041
  // logger.log('AVC PID:' + pid);
12042
12042
  if (result.videoPid === -1) {
12043
12043
  result.videoPid = pid;
12044
- result.segmentVideoCodec = 'avc';
12045
12044
  }
12046
12045
  break;
12047
12046
 
@@ -12469,7 +12468,7 @@
12469
12468
  0x00, 0x00]));
12470
12469
  };
12471
12470
  MP4.mdia = function mdia(track) {
12472
- return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track));
12471
+ return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale || 0, track.duration || 0), MP4.hdlr(track.type), MP4.minf(track));
12473
12472
  };
12474
12473
  MP4.mfhd = function mfhd(sequenceNumber) {
12475
12474
  return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00,
@@ -12493,7 +12492,7 @@
12493
12492
  while (i--) {
12494
12493
  boxes[i] = MP4.trak(tracks[i]);
12495
12494
  }
12496
- return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale, tracks[0].duration)].concat(boxes).concat(MP4.mvex(tracks)));
12495
+ return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale || 0, tracks[0].duration || 0)].concat(boxes).concat(MP4.mvex(tracks)));
12497
12496
  };
12498
12497
  MP4.mvex = function mvex(tracks) {
12499
12498
  var i = tracks.length;
@@ -12677,7 +12676,7 @@
12677
12676
  ]));
12678
12677
  };
12679
12678
  MP4.audioStsd = function audioStsd(track) {
12680
- var samplerate = track.samplerate;
12679
+ var samplerate = track.samplerate || 0;
12681
12680
  return new Uint8Array([0x00, 0x00, 0x00,
12682
12681
  // reserved
12683
12682
  0x00, 0x00, 0x00,
@@ -12686,7 +12685,7 @@
12686
12685
  // data_reference_index
12687
12686
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12688
12687
  // reserved
12689
- 0x00, track.channelCount,
12688
+ 0x00, track.channelCount || 0,
12690
12689
  // channelcount
12691
12690
  0x00, 0x10,
12692
12691
  // sampleSize:16bits
@@ -12706,25 +12705,30 @@
12706
12705
  return MP4.box(MP4.types['ac-3'], MP4.audioStsd(track), MP4.box(MP4.types.dac3, track.config));
12707
12706
  };
12708
12707
  MP4.stsd = function stsd(track) {
12708
+ var segmentCodec = track.segmentCodec;
12709
12709
  if (track.type === 'audio') {
12710
- if (track.segmentCodec === 'mp3' && track.codec === 'mp3') {
12711
- return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));
12710
+ if (segmentCodec === 'aac') {
12711
+ return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));
12712
12712
  }
12713
- if (track.segmentCodec === 'ac3') {
12714
- return MP4.box(MP4.types.stsd, MP4.STSD, MP4.ac3(track));
12713
+ if (segmentCodec === 'mp3' && track.codec === 'mp3') {
12714
+ return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));
12715
12715
  }
12716
- return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));
12717
- } else if (track.segmentCodec === 'avc') {
12718
- return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));
12719
12716
  } else {
12720
- return MP4.box(MP4.types.stsd, MP4.STSD, MP4.hvc1(track));
12717
+ if (track.pps && track.sps) {
12718
+ if (segmentCodec === 'avc') {
12719
+ return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));
12720
+ }
12721
+ } else {
12722
+ throw new Error("video track missing pps or sps");
12723
+ }
12721
12724
  }
12725
+ throw new Error("unsupported " + track.type + " segment codec (" + segmentCodec + "/" + track.codec + ")");
12722
12726
  };
12723
12727
  MP4.tkhd = function tkhd(track) {
12724
12728
  var id = track.id;
12725
- var duration = track.duration * track.timescale;
12726
- var width = track.width;
12727
- var height = track.height;
12729
+ var duration = (track.duration || 0) * (track.timescale || 0);
12730
+ var width = track.width || 0;
12731
+ var height = track.height || 0;
12728
12732
  var upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));
12729
12733
  var lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));
12730
12734
  return MP4.box(MP4.types.tkhd, new Uint8Array([0x01,
@@ -12856,82 +12860,9 @@
12856
12860
  return result;
12857
12861
  };
12858
12862
  MP4.hvc1 = function hvc1(track) {
12859
- var ps = track.params;
12860
- var units = [track.vps, track.sps, track.pps];
12861
- var NALuLengthSize = 4;
12862
- var config = new Uint8Array([0x01, ps.general_profile_space << 6 | (ps.general_tier_flag ? 32 : 0) | ps.general_profile_idc, ps.general_profile_compatibility_flags[0], ps.general_profile_compatibility_flags[1], ps.general_profile_compatibility_flags[2], ps.general_profile_compatibility_flags[3], ps.general_constraint_indicator_flags[0], ps.general_constraint_indicator_flags[1], ps.general_constraint_indicator_flags[2], ps.general_constraint_indicator_flags[3], ps.general_constraint_indicator_flags[4], ps.general_constraint_indicator_flags[5], ps.general_level_idc, 240 | ps.min_spatial_segmentation_idc >> 8, 255 & ps.min_spatial_segmentation_idc, 252 | ps.parallelismType, 252 | ps.chroma_format_idc, 248 | ps.bit_depth_luma_minus8, 248 | ps.bit_depth_chroma_minus8, 0x00, parseInt(ps.frame_rate.fps), NALuLengthSize - 1 | ps.temporal_id_nested << 2 | ps.num_temporal_layers << 3 | (ps.frame_rate.fixed ? 64 : 0), units.length]);
12863
-
12864
- // compute hvcC size in bytes
12865
- var length = config.length;
12866
- for (var i = 0; i < units.length; i += 1) {
12867
- length += 3;
12868
- for (var j = 0; j < units[i].length; j += 1) {
12869
- length += 2 + units[i][j].length;
12870
- }
12871
- }
12872
- var hvcC = new Uint8Array(length);
12873
- hvcC.set(config, 0);
12874
- length = config.length;
12875
- // append parameter set units: one vps, one or more sps and pps
12876
- var iMax = units.length - 1;
12877
- for (var _i = 0; _i < units.length; _i += 1) {
12878
- hvcC.set(new Uint8Array([32 + _i | (_i === iMax ? 128 : 0), 0x00, units[_i].length]), length);
12879
- length += 3;
12880
- for (var _j = 0; _j < units[_i].length; _j += 1) {
12881
- hvcC.set(new Uint8Array([units[_i][_j].length >> 8, units[_i][_j].length & 255]), length);
12882
- length += 2;
12883
- hvcC.set(units[_i][_j], length);
12884
- length += units[_i][_j].length;
12885
- }
12886
- }
12887
- var hvcc = MP4.box(MP4.types.hvcC, hvcC);
12888
- var width = track.width;
12889
- var height = track.height;
12890
- var hSpacing = track.pixelRatio[0];
12891
- var vSpacing = track.pixelRatio[1];
12892
- return MP4.box(MP4.types.hvc1, new Uint8Array([0x00, 0x00, 0x00,
12893
- // reserved
12894
- 0x00, 0x00, 0x00,
12895
- // reserved
12896
- 0x00, 0x01,
12897
- // data_reference_index
12898
- 0x00, 0x00,
12899
- // pre_defined
12900
- 0x00, 0x00,
12901
- // reserved
12902
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12903
- // pre_defined
12904
- width >> 8 & 0xff, width & 0xff,
12905
- // width
12906
- height >> 8 & 0xff, height & 0xff,
12907
- // height
12908
- 0x00, 0x48, 0x00, 0x00,
12909
- // horizresolution
12910
- 0x00, 0x48, 0x00, 0x00,
12911
- // vertresolution
12912
- 0x00, 0x00, 0x00, 0x00,
12913
- // reserved
12914
- 0x00, 0x01,
12915
- // frame_count
12916
- 0x12, 0x64, 0x61, 0x69, 0x6c,
12917
- // dailymotion/hls.js
12918
- 0x79, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x68, 0x6c, 0x73, 0x2e, 0x6a, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12919
- // compressorname
12920
- 0x00, 0x18,
12921
- // depth = 24
12922
- 0x11, 0x11]),
12923
- // pre_defined = -1
12924
- hvcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80,
12925
- // bufferSizeDB
12926
- 0x00, 0x2d, 0xc6, 0xc0,
12927
- // maxBitrate
12928
- 0x00, 0x2d, 0xc6, 0xc0])),
12929
- // avgBitrate
12930
- MP4.box(MP4.types.pasp, new Uint8Array([hSpacing >> 24,
12931
- // hSpacing
12932
- hSpacing >> 16 & 0xff, hSpacing >> 8 & 0xff, hSpacing & 0xff, vSpacing >> 24,
12933
- // vSpacing
12934
- vSpacing >> 16 & 0xff, vSpacing >> 8 & 0xff, vSpacing & 0xff])));
12863
+ {
12864
+ return new Uint8Array();
12865
+ }
12935
12866
  };
12936
12867
  return MP4;
12937
12868
  }();
@@ -12965,6 +12896,21 @@
12965
12896
  var AC3_SAMPLES_PER_FRAME = 1536;
12966
12897
  var chromeVersion = null;
12967
12898
  var safariWebkitVersion = null;
12899
+ function createMp4Sample(isKeyframe, duration, size, cts) {
12900
+ return {
12901
+ duration: duration,
12902
+ size: size,
12903
+ cts: cts,
12904
+ flags: {
12905
+ isLeading: 0,
12906
+ isDependedOn: 0,
12907
+ hasRedundancy: 0,
12908
+ degradPrio: 0,
12909
+ dependsOn: isKeyframe ? 2 : 1,
12910
+ isNonSync: isKeyframe ? 0 : 1
12911
+ }
12912
+ };
12913
+ }
12968
12914
  var MP4Remuxer = /*#__PURE__*/function () {
12969
12915
  function MP4Remuxer(observer, config, typeSupported, logger) {
12970
12916
  this.logger = void 0;
@@ -13464,7 +13410,7 @@
13464
13410
  maxDtsDelta = Math.max(maxDtsDelta, mp4SampleDuration);
13465
13411
  minPtsDelta = Math.min(minPtsDelta, ptsDelta);
13466
13412
  maxPtsDelta = Math.max(maxPtsDelta, ptsDelta);
13467
- outputSamples.push(new Mp4Sample(VideoSample.key, mp4SampleDuration, mp4SampleLength, compositionTimeOffset));
13413
+ outputSamples.push(createMp4Sample(VideoSample.key, mp4SampleDuration, mp4SampleLength, compositionTimeOffset));
13468
13414
  }
13469
13415
  if (outputSamples.length) {
13470
13416
  if (chromeVersion) {
@@ -13501,7 +13447,7 @@
13501
13447
  this.nextAvcDts = nextAvcDts = lastDTS + mp4SampleDuration;
13502
13448
  this.videoSampleDuration = mp4SampleDuration;
13503
13449
  this.isVideoContiguous = true;
13504
- var moof = MP4.moof(track.sequenceNumber++, firstDTS, _extends({}, track, {
13450
+ var moof = MP4.moof(track.sequenceNumber++, firstDTS, _extends(track, {
13505
13451
  samples: outputSamples
13506
13452
  }));
13507
13453
  var type = 'video';
@@ -13705,7 +13651,7 @@
13705
13651
  // Default the sample's duration to the computed mp4SampleDuration, which will either be 1024 for AAC or 1152 for MPEG
13706
13652
  // In the case that we have 1 sample, this will be the duration. If we have more than one sample, the duration
13707
13653
  // becomes the PTS diff with the previous sample
13708
- outputSamples.push(new Mp4Sample(true, mp4SampleDuration, unitLen, 0));
13654
+ outputSamples.push(createMp4Sample(true, mp4SampleDuration, unitLen, 0));
13709
13655
  lastPTS = _pts2;
13710
13656
  }
13711
13657
 
@@ -13814,23 +13760,6 @@
13814
13760
  samples: samples
13815
13761
  };
13816
13762
  }
13817
- var Mp4Sample = function Mp4Sample(isKeyframe, duration, size, cts) {
13818
- this.size = void 0;
13819
- this.duration = void 0;
13820
- this.cts = void 0;
13821
- this.flags = void 0;
13822
- this.duration = duration;
13823
- this.size = size;
13824
- this.cts = cts;
13825
- this.flags = {
13826
- isLeading: 0,
13827
- isDependedOn: 0,
13828
- hasRedundancy: 0,
13829
- degradPrio: 0,
13830
- dependsOn: isKeyframe ? 2 : 1,
13831
- isNonSync: isKeyframe ? 0 : 1
13832
- };
13833
- };
13834
13763
 
13835
13764
  var PassThroughRemuxer = /*#__PURE__*/function () {
13836
13765
  function PassThroughRemuxer(observer, config, typeSupported, logger) {
@@ -19806,7 +19735,7 @@
19806
19735
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
19807
19736
  }
19808
19737
 
19809
- var version = "1.6.0-beta.2.0.canary.10873";
19738
+ var version = "1.6.0-beta.2.0.canary.10877";
19810
19739
 
19811
19740
  // ensure the worker ends up in the bundle
19812
19741
  // If the worker should not be included this gets aliased to empty.js
@@ -21548,7 +21477,7 @@
21548
21477
  };
21549
21478
  _proto.load = function load(frag) {
21550
21479
  var _this2 = this;
21551
- if (!frag.decryptdata && frag.encrypted && this.emeController) {
21480
+ if (!frag.decryptdata && frag.encrypted && this.emeController && this.config.emeEnabled) {
21552
21481
  // Multiple keys, but none selected, resolve in eme-controller
21553
21482
  return this.emeController.selectKeySystemFormat(frag).then(function (keySystemFormat) {
21554
21483
  return _this2.loadInternal(frag, keySystemFormat);