hls.js 1.5.19 → 1.5.20

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
@@ -552,7 +552,7 @@
552
552
  // Some browsers don't allow to use bind on console object anyway
553
553
  // fallback to default if needed
554
554
  try {
555
- exportedLogger.log("Debug logs enabled for \"" + id + "\" in hls.js version " + "1.5.19");
555
+ exportedLogger.log("Debug logs enabled for \"" + id + "\" in hls.js version " + "1.5.20");
556
556
  } catch (e) {
557
557
  exportedLogger = fakeLogger;
558
558
  }
@@ -7174,10 +7174,9 @@
7174
7174
  name = option.name,
7175
7175
  lang = option.lang,
7176
7176
  assocLang = option.assocLang,
7177
- characteristics = option.characteristics,
7178
7177
  isDefault = option.default;
7179
7178
  var forced = option.forced;
7180
- return (groupId === undefined || track.groupId === groupId) && (name === undefined || track.name === name) && (lang === undefined || track.lang === lang) && (lang === undefined || track.assocLang === assocLang) && (isDefault === undefined || track.default === isDefault) && (forced === undefined || track.forced === forced) && (characteristics === undefined || characteristicsMatch(characteristics, track.characteristics)) && (matchPredicate === undefined || matchPredicate(option, track));
7179
+ return (groupId === undefined || track.groupId === groupId) && (name === undefined || track.name === name) && (lang === undefined || track.lang === lang) && (lang === undefined || track.assocLang === assocLang) && (isDefault === undefined || track.default === isDefault) && (forced === undefined || track.forced === forced) && (!('characteristics' in option) || characteristicsMatch(option.characteristics || '', track.characteristics)) && (matchPredicate === undefined || matchPredicate(option, track));
7181
7180
  }
7182
7181
  function characteristicsMatch(characteristicsA, characteristicsB) {
7183
7182
  if (characteristicsB === void 0) {
@@ -16263,32 +16262,6 @@
16263
16262
  return TransmuxerInterface;
16264
16263
  }();
16265
16264
 
16266
- function subtitleOptionsIdentical(trackList1, trackList2) {
16267
- if (trackList1.length !== trackList2.length) {
16268
- return false;
16269
- }
16270
- for (var i = 0; i < trackList1.length; i++) {
16271
- if (!mediaAttributesIdentical(trackList1[i].attrs, trackList2[i].attrs)) {
16272
- return false;
16273
- }
16274
- }
16275
- return true;
16276
- }
16277
- function mediaAttributesIdentical(attrs1, attrs2, customAttributes) {
16278
- // Media options with the same rendition ID must be bit identical
16279
- var stableRenditionId = attrs1['STABLE-RENDITION-ID'];
16280
- if (stableRenditionId && !customAttributes) {
16281
- return stableRenditionId === attrs2['STABLE-RENDITION-ID'];
16282
- }
16283
- // When rendition ID is not present, compare attributes
16284
- return !(customAttributes || ['LANGUAGE', 'NAME', 'CHARACTERISTICS', 'AUTOSELECT', 'DEFAULT', 'FORCED', 'ASSOC-LANGUAGE']).some(function (subtitleAttribute) {
16285
- return attrs1[subtitleAttribute] !== attrs2[subtitleAttribute];
16286
- });
16287
- }
16288
- function subtitleTrackMatchesTextTrack(subtitleTrack, textTrack) {
16289
- return textTrack.label.toLowerCase() === subtitleTrack.name.toLowerCase() && (!textTrack.language || textTrack.language.toLowerCase() === (subtitleTrack.lang || '').toLowerCase());
16290
- }
16291
-
16292
16265
  var TICK_INTERVAL$2 = 100; // how often to tick in ms
16293
16266
  var AudioStreamController = /*#__PURE__*/function (_BaseStreamController) {
16294
16267
  _inheritsLoose(AudioStreamController, _BaseStreamController);
@@ -16526,9 +16499,7 @@
16526
16499
  if (bufferInfo === null) {
16527
16500
  return;
16528
16501
  }
16529
- var bufferedTrack = this.bufferedTrack,
16530
- switchingTrack = this.switchingTrack;
16531
- if (!switchingTrack && this._streamEnded(bufferInfo, trackDetails)) {
16502
+ if (!this.switchingTrack && this._streamEnded(bufferInfo, trackDetails)) {
16532
16503
  hls.trigger(Events.BUFFER_EOS, {
16533
16504
  type: 'audio'
16534
16505
  });
@@ -16540,13 +16511,10 @@
16540
16511
  var maxBufLen = this.getMaxBufferLength(mainBufferInfo == null ? void 0 : mainBufferInfo.len);
16541
16512
  var fragments = trackDetails.fragments;
16542
16513
  var start = fragments[0].start;
16543
- var targetBufferTime = this.flushing ? this.getLoadPosition() : bufferInfo.end;
16544
- if (switchingTrack && media) {
16545
- var pos = this.getLoadPosition();
16546
- // STABLE
16547
- if (bufferedTrack && !mediaAttributesIdentical(switchingTrack.attrs, bufferedTrack.attrs)) {
16548
- targetBufferTime = pos;
16549
- }
16514
+ var loadPosition = this.getLoadPosition();
16515
+ var targetBufferTime = this.flushing ? loadPosition : bufferInfo.end;
16516
+ if (this.switchingTrack && media) {
16517
+ var pos = loadPosition;
16550
16518
  // if currentTime (pos) is less than alt audio playlist start time, it means that alt audio is ahead of currentTime
16551
16519
  if (trackDetails.PTSKnown && pos < start) {
16552
16520
  // if everything is buffered from pos to start or if audio buffer upfront, let's seek to start
@@ -16558,7 +16526,7 @@
16558
16526
  }
16559
16527
 
16560
16528
  // if buffer length is less than maxBufLen, or near the end, find a fragment to load
16561
- if (bufferLen >= maxBufLen && !switchingTrack && targetBufferTime < fragments[fragments.length - 1].start) {
16529
+ if (bufferLen >= maxBufLen && !this.switchingTrack && targetBufferTime < fragments[fragments.length - 1].start) {
16562
16530
  return;
16563
16531
  }
16564
16532
  var frag = this.getNextFragment(targetBufferTime, trackDetails);
@@ -17013,14 +16981,26 @@
17013
16981
  }
17014
16982
  };
17015
16983
  _proto.flushAudioIfNeeded = function flushAudioIfNeeded(switchingTrack) {
17016
- var media = this.media,
17017
- bufferedTrack = this.bufferedTrack;
17018
- var bufferedAttributes = bufferedTrack == null ? void 0 : bufferedTrack.attrs;
17019
- var switchAttributes = switchingTrack.attrs;
17020
- if (media && bufferedAttributes && (bufferedAttributes.CHANNELS !== switchAttributes.CHANNELS || bufferedTrack.name !== switchingTrack.name || bufferedTrack.lang !== switchingTrack.lang)) {
17021
- this.log('Switching audio track : flushing all audio');
17022
- _BaseStreamController.prototype.flushMainBuffer.call(this, 0, Number.POSITIVE_INFINITY, 'audio');
17023
- this.bufferedTrack = null;
16984
+ if (this.media && this.bufferedTrack) {
16985
+ var _this$bufferedTrack = this.bufferedTrack,
16986
+ name = _this$bufferedTrack.name,
16987
+ lang = _this$bufferedTrack.lang,
16988
+ assocLang = _this$bufferedTrack.assocLang,
16989
+ characteristics = _this$bufferedTrack.characteristics,
16990
+ audioCodec = _this$bufferedTrack.audioCodec,
16991
+ channels = _this$bufferedTrack.channels;
16992
+ if (!matchesOption({
16993
+ name: name,
16994
+ lang: lang,
16995
+ assocLang: assocLang,
16996
+ characteristics: characteristics,
16997
+ audioCodec: audioCodec,
16998
+ channels: channels
16999
+ }, switchingTrack, audioMatchPredicate)) {
17000
+ this.log('Switching audio track : flushing all audio');
17001
+ _BaseStreamController.prototype.flushMainBuffer.call(this, 0, Number.POSITIVE_INFINITY, 'audio');
17002
+ this.bufferedTrack = null;
17003
+ }
17024
17004
  }
17025
17005
  };
17026
17006
  _proto.completeAudioSwitch = function completeAudioSwitch(switchingTrack) {
@@ -17033,6 +17013,32 @@
17033
17013
  return AudioStreamController;
17034
17014
  }(BaseStreamController);
17035
17015
 
17016
+ function subtitleOptionsIdentical(trackList1, trackList2) {
17017
+ if (trackList1.length !== trackList2.length) {
17018
+ return false;
17019
+ }
17020
+ for (var i = 0; i < trackList1.length; i++) {
17021
+ if (!mediaAttributesIdentical(trackList1[i].attrs, trackList2[i].attrs)) {
17022
+ return false;
17023
+ }
17024
+ }
17025
+ return true;
17026
+ }
17027
+ function mediaAttributesIdentical(attrs1, attrs2, customAttributes) {
17028
+ // Media options with the same rendition ID must be bit identical
17029
+ var stableRenditionId = attrs1['STABLE-RENDITION-ID'];
17030
+ if (stableRenditionId && !customAttributes) {
17031
+ return stableRenditionId === attrs2['STABLE-RENDITION-ID'];
17032
+ }
17033
+ // When rendition ID is not present, compare attributes
17034
+ return !(customAttributes || ['LANGUAGE', 'NAME', 'CHARACTERISTICS', 'AUTOSELECT', 'DEFAULT', 'FORCED', 'ASSOC-LANGUAGE']).some(function (subtitleAttribute) {
17035
+ return attrs1[subtitleAttribute] !== attrs2[subtitleAttribute];
17036
+ });
17037
+ }
17038
+ function subtitleTrackMatchesTextTrack(subtitleTrack, textTrack) {
17039
+ return textTrack.label.toLowerCase() === subtitleTrack.name.toLowerCase() && (!textTrack.language || textTrack.language.toLowerCase() === (subtitleTrack.lang || '').toLowerCase());
17040
+ }
17041
+
17036
17042
  var AudioTrackController = /*#__PURE__*/function (_BasePlaylistControll) {
17037
17043
  _inheritsLoose(AudioTrackController, _BasePlaylistControll);
17038
17044
  function AudioTrackController(hls) {
@@ -29369,7 +29375,7 @@
29369
29375
  * Get the video-dev/hls.js package version.
29370
29376
  */
29371
29377
  function get() {
29372
- return "1.5.19";
29378
+ return "1.5.20";
29373
29379
  }
29374
29380
  }, {
29375
29381
  key: "Events",