hls.js 1.6.0-beta.1.0.canary.10808 → 1.6.0-beta.1.0.canary.10810

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
@@ -1028,7 +1028,7 @@
1028
1028
  // Some browsers don't allow to use bind on console object anyway
1029
1029
  // fallback to default if needed
1030
1030
  try {
1031
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10808");
1031
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10810");
1032
1032
  } catch (e) {
1033
1033
  /* log fn threw an exception. All logger methods are no-ops. */
1034
1034
  return createLogger();
@@ -1749,6 +1749,10 @@
1749
1749
  return tiers;
1750
1750
  }, {});
1751
1751
  }
1752
+ function useAlternateAudio(audioTrackUrl, hls) {
1753
+ var _hls$levels$hls$loadL;
1754
+ return !!audioTrackUrl && audioTrackUrl !== ((_hls$levels$hls$loadL = hls.levels[hls.loadLevel]) == null ? void 0 : _hls$levels$hls$loadL.uri);
1755
+ }
1752
1756
 
1753
1757
  var AbrController = /*#__PURE__*/function (_Logger) {
1754
1758
  function AbrController(_hls) {
@@ -10411,7 +10415,8 @@
10411
10415
  var _this = this;
10412
10416
  if (this.useSoftware) {
10413
10417
  return new Promise(function (resolve, reject) {
10414
- _this.softwareDecrypt(new Uint8Array(data), key, iv, aesMode);
10418
+ var dataView = ArrayBuffer.isView(data) ? data : new Uint8Array(data);
10419
+ _this.softwareDecrypt(dataView, key, iv, aesMode);
10415
10420
  var decryptResult = _this.flush();
10416
10421
  if (decryptResult) {
10417
10422
  resolve(decryptResult.buffer);
@@ -14098,7 +14103,8 @@
14098
14103
  // For Low-Latency HLS Parts, decrypt in place, since part parsing is expected on push progress
14099
14104
  var loadingParts = chunkMeta.part > -1;
14100
14105
  if (loadingParts) {
14101
- decryptedData = decrypter.flush();
14106
+ var _data = decrypter.flush();
14107
+ decryptedData = _data ? _data.buffer : _data;
14102
14108
  }
14103
14109
  if (!decryptedData) {
14104
14110
  stats.executeEnd = now();
@@ -14178,7 +14184,7 @@
14178
14184
  var decryptedData = decrypter.flush();
14179
14185
  if (decryptedData) {
14180
14186
  // Push always returns a TransmuxerResult if decryptdata is null
14181
- transmuxResults.push(this.push(decryptedData, null, chunkMeta));
14187
+ transmuxResults.push(this.push(decryptedData.buffer, null, chunkMeta));
14182
14188
  }
14183
14189
  }
14184
14190
  var demuxer = this.demuxer,
@@ -14535,7 +14541,7 @@
14535
14541
  return reader.read().then(function (data) {
14536
14542
  if (data.done) {
14537
14543
  if (chunkCache.dataLength) {
14538
- onProgress(stats, context, chunkCache.flush(), response);
14544
+ onProgress(stats, context, chunkCache.flush().buffer, response);
14539
14545
  }
14540
14546
  return Promise.resolve(new ArrayBuffer(0));
14541
14547
  }
@@ -14548,12 +14554,12 @@
14548
14554
  chunkCache.push(chunk);
14549
14555
  if (chunkCache.dataLength >= highWaterMark) {
14550
14556
  // flush in order to join the typed arrays
14551
- onProgress(stats, context, chunkCache.flush(), response);
14557
+ onProgress(stats, context, chunkCache.flush().buffer, response);
14552
14558
  }
14553
14559
  } else {
14554
14560
  // If there's nothing cached already, and the chache is large enough
14555
14561
  // just emit the progress event
14556
- onProgress(stats, context, chunk, response);
14562
+ onProgress(stats, context, chunk.buffer, response);
14557
14563
  }
14558
14564
  return _pump();
14559
14565
  }).catch(function () {
@@ -19756,7 +19762,7 @@
19756
19762
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
19757
19763
  }
19758
19764
 
19759
- var version = "1.6.0-beta.1.0.canary.10808";
19765
+ var version = "1.6.0-beta.1.0.canary.10810";
19760
19766
 
19761
19767
  // ensure the worker ends up in the bundle
19762
19768
  // If the worker should not be included this gets aliased to empty.js
@@ -20750,9 +20756,10 @@
20750
20756
  transmuxer.push(payload, initSegmentData, audioCodec, videoCodec, frag, part, details.totalduration, accurateTimeOffset, chunkMeta, initPTS);
20751
20757
  };
20752
20758
  _proto.onAudioTrackSwitching = function onAudioTrackSwitching(event, data) {
20759
+ var hls = this.hls;
20753
20760
  // if any URL found on new audio track, it is an alternate audio track
20754
20761
  var fromAltAudio = this.altAudio === 2;
20755
- var altAudio = !!data.url;
20762
+ var altAudio = useAlternateAudio(data.url, hls);
20756
20763
  // if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered
20757
20764
  // don't do anything if we switch to alt audio: audio stream controller is handling it.
20758
20765
  // we will just have to change buffer scheduling on audioTrackSwitched
@@ -20775,7 +20782,6 @@
20775
20782
  // Reset audio transmuxer so when switching back to main audio we're not still appending where we left off
20776
20783
  this.resetTransmuxer();
20777
20784
  }
20778
- var hls = this.hls;
20779
20785
  // If switching from alt to main audio, flush all audio and trigger track switched
20780
20786
  if (fromAltAudio) {
20781
20787
  hls.trigger(Events.BUFFER_FLUSHING, {
@@ -20791,8 +20797,7 @@
20791
20797
  }
20792
20798
  };
20793
20799
  _proto.onAudioTrackSwitched = function onAudioTrackSwitched(event, data) {
20794
- var trackId = data.id;
20795
- var altAudio = !!this.hls.audioTracks[trackId].url;
20800
+ var altAudio = useAlternateAudio(data.url, this.hls);
20796
20801
  if (altAudio) {
20797
20802
  var videoBuffer = this.videoBuffer;
20798
20803
  // if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered