hls.js 1.6.0-beta.1.0.canary.10818 → 1.6.0-beta.1.0.canary.10819

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
@@ -823,6 +823,7 @@
823
823
  Events["INTERSTITIAL_ENDED"] = "hlsInterstitialEnded";
824
824
  Events["INTERSTITIALS_PRIMARY_RESUMED"] = "hlsInterstitialsPrimaryResumed";
825
825
  Events["PLAYOUT_LIMIT_REACHED"] = "hlsPlayoutLimitReached";
826
+ Events["EVENT_CUE_ENTER"] = "hlsEventCueEnter";
826
827
  return Events;
827
828
  }({});
828
829
 
@@ -1028,7 +1029,7 @@
1028
1029
  // Some browsers don't allow to use bind on console object anyway
1029
1030
  // fallback to default if needed
1030
1031
  try {
1031
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10818");
1032
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10819");
1032
1033
  } catch (e) {
1033
1034
  /* log fn threw an exception. All logger methods are no-ops. */
1034
1035
  return createLogger();
@@ -15717,7 +15718,7 @@
15717
15718
  event.track = track;
15718
15719
  videoEl.dispatchEvent(event);
15719
15720
  }
15720
- function clearCurrentCues(track) {
15721
+ function clearCurrentCues(track, enterHandler) {
15721
15722
  // When track.mode is disabled, track.cues will be null.
15722
15723
  // To guarantee the removal of cues, we need to temporarily
15723
15724
  // change the mode to hidden
@@ -15727,6 +15728,9 @@
15727
15728
  }
15728
15729
  if (track.cues) {
15729
15730
  for (var i = track.cues.length; i--;) {
15731
+ if (enterHandler) {
15732
+ track.cues[i].removeEventListener('enter', enterHandler);
15733
+ }
15730
15734
  track.removeCue(track.cues[i]);
15731
15735
  }
15732
15736
  }
@@ -15833,11 +15837,18 @@
15833
15837
  }
15834
15838
  var ID3TrackController = /*#__PURE__*/function () {
15835
15839
  function ID3TrackController(hls) {
15840
+ var _this = this;
15836
15841
  this.hls = void 0;
15837
15842
  this.id3Track = null;
15838
15843
  this.media = null;
15839
15844
  this.dateRangeCuesAppended = {};
15840
15845
  this.removeCues = true;
15846
+ this.onEventCueEnter = function () {
15847
+ if (!_this.hls) {
15848
+ return;
15849
+ }
15850
+ _this.hls.trigger(Events.EVENT_CUE_ENTER, {});
15851
+ };
15841
15852
  this.hls = hls;
15842
15853
  this._registerListeners();
15843
15854
  }
@@ -15848,11 +15859,12 @@
15848
15859
  this.media = null;
15849
15860
  this.dateRangeCuesAppended = {};
15850
15861
  // @ts-ignore
15851
- this.hls = null;
15862
+ this.hls = this.onEventCueEnter = null;
15852
15863
  };
15853
15864
  _proto._registerListeners = function _registerListeners() {
15854
15865
  var hls = this.hls;
15855
15866
  hls.on(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
15867
+ hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
15856
15868
  hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
15857
15869
  hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
15858
15870
  hls.on(Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this);
@@ -15863,16 +15875,15 @@
15863
15875
  _proto._unregisterListeners = function _unregisterListeners() {
15864
15876
  var hls = this.hls;
15865
15877
  hls.off(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
15878
+ hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
15866
15879
  hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
15867
15880
  hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
15868
15881
  hls.off(Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this);
15869
15882
  hls.off(Events.BUFFER_FLUSHING, this.onBufferFlushing, this);
15870
15883
  hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
15871
15884
  hls.off(Events.LEVEL_PTS_UPDATED, this.onLevelPtsUpdated, this);
15872
- }
15873
-
15885
+ };
15874
15886
  // Add ID3 metatadata text track.
15875
- ;
15876
15887
  _proto.onMediaAttaching = function onMediaAttaching(event, data) {
15877
15888
  var _data$overrides;
15878
15889
  this.media = data.media;
@@ -15880,6 +15891,12 @@
15880
15891
  this.removeCues = false;
15881
15892
  }
15882
15893
  };
15894
+ _proto.onMediaAttached = function onMediaAttached() {
15895
+ var details = this.hls.latestLevelDetails;
15896
+ if (details) {
15897
+ this.updateDateRangeCues(details);
15898
+ }
15899
+ };
15883
15900
  _proto.onMediaDetaching = function onMediaDetaching(event, data) {
15884
15901
  this.media = null;
15885
15902
  var transferringMedia = !!data.transferMedia;
@@ -15888,7 +15905,7 @@
15888
15905
  }
15889
15906
  if (this.id3Track) {
15890
15907
  if (this.removeCues) {
15891
- clearCurrentCues(this.id3Track);
15908
+ clearCurrentCues(this.id3Track, this.onEventCueEnter);
15892
15909
  }
15893
15910
  this.id3Track = null;
15894
15911
  }
@@ -16020,7 +16037,7 @@
16020
16037
  }
16021
16038
  };
16022
16039
  _proto.updateDateRangeCues = function updateDateRangeCues(details, removeOldCues) {
16023
- var _this = this;
16040
+ var _this2 = this;
16024
16041
  if (!this.media || !details.hasProgramDateTime || !this.hls.config.enableDateRangeMetadataCues) {
16025
16042
  return;
16026
16043
  }
@@ -16041,7 +16058,9 @@
16041
16058
  delete dateRangeCuesAppended[id];
16042
16059
  Object.keys(cues).forEach(function (key) {
16043
16060
  try {
16044
- id3Track.removeCue(cues[key]);
16061
+ var cue = cues[key];
16062
+ cue.removeEventListener('enter', _this2.onEventCueEnter);
16063
+ id3Track.removeCue(cue);
16045
16064
  } catch (e) {
16046
16065
  /* no-op */
16047
16066
  }
@@ -16115,13 +16134,14 @@
16115
16134
  if (isSCTE35Attribute(key)) {
16116
16135
  data = hexToArrayBuffer(data);
16117
16136
  }
16118
- var _cue = createCueWithDataFields(Cue, startTime, endTime, {
16137
+ var payload = {
16119
16138
  key: key,
16120
16139
  data: data
16121
- }, MetadataSchema.dateRange);
16140
+ };
16141
+ var _cue = createCueWithDataFields(Cue, startTime, endTime, payload, MetadataSchema.dateRange);
16122
16142
  if (_cue) {
16123
16143
  _cue.id = id;
16124
- _this.id3Track.addCue(_cue);
16144
+ _this2.id3Track.addCue(_cue);
16125
16145
  cues[key] = _cue;
16126
16146
  }
16127
16147
  }
@@ -19766,7 +19786,7 @@
19766
19786
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
19767
19787
  }
19768
19788
 
19769
- var version = "1.6.0-beta.1.0.canary.10818";
19789
+ var version = "1.6.0-beta.1.0.canary.10819";
19770
19790
 
19771
19791
  // ensure the worker ends up in the bundle
19772
19792
  // If the worker should not be included this gets aliased to empty.js