hls.js 1.6.0-beta.1.0.canary.10817 → 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.
@@ -144,6 +144,7 @@ let Events = /*#__PURE__*/function (Events) {
144
144
  Events["INTERSTITIAL_ENDED"] = "hlsInterstitialEnded";
145
145
  Events["INTERSTITIALS_PRIMARY_RESUMED"] = "hlsInterstitialsPrimaryResumed";
146
146
  Events["PLAYOUT_LIMIT_REACHED"] = "hlsPlayoutLimitReached";
147
+ Events["EVENT_CUE_ENTER"] = "hlsEventCueEnter";
147
148
  return Events;
148
149
  }({});
149
150
 
@@ -400,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
400
401
  // Some browsers don't allow to use bind on console object anyway
401
402
  // fallback to default if needed
402
403
  try {
403
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10817"}`);
404
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10819"}`);
404
405
  } catch (e) {
405
406
  /* log fn threw an exception. All logger methods are no-ops. */
406
407
  return createLogger();
@@ -17588,7 +17589,7 @@ function sendAddTrackEvent(track, videoEl) {
17588
17589
  event.track = track;
17589
17590
  videoEl.dispatchEvent(event);
17590
17591
  }
17591
- function clearCurrentCues(track) {
17592
+ function clearCurrentCues(track, enterHandler) {
17592
17593
  // When track.mode is disabled, track.cues will be null.
17593
17594
  // To guarantee the removal of cues, we need to temporarily
17594
17595
  // change the mode to hidden
@@ -17598,6 +17599,9 @@ function clearCurrentCues(track) {
17598
17599
  }
17599
17600
  if (track.cues) {
17600
17601
  for (let i = track.cues.length; i--;) {
17602
+ if (enterHandler) {
17603
+ track.cues[i].removeEventListener('enter', enterHandler);
17604
+ }
17601
17605
  track.removeCue(track.cues[i]);
17602
17606
  }
17603
17607
  }
@@ -17709,6 +17713,12 @@ class ID3TrackController {
17709
17713
  this.media = null;
17710
17714
  this.dateRangeCuesAppended = {};
17711
17715
  this.removeCues = true;
17716
+ this.onEventCueEnter = () => {
17717
+ if (!this.hls) {
17718
+ return;
17719
+ }
17720
+ this.hls.trigger(Events.EVENT_CUE_ENTER, {});
17721
+ };
17712
17722
  this.hls = hls;
17713
17723
  this._registerListeners();
17714
17724
  }
@@ -17718,13 +17728,14 @@ class ID3TrackController {
17718
17728
  this.media = null;
17719
17729
  this.dateRangeCuesAppended = {};
17720
17730
  // @ts-ignore
17721
- this.hls = null;
17731
+ this.hls = this.onEventCueEnter = null;
17722
17732
  }
17723
17733
  _registerListeners() {
17724
17734
  const {
17725
17735
  hls
17726
17736
  } = this;
17727
17737
  hls.on(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
17738
+ hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
17728
17739
  hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
17729
17740
  hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
17730
17741
  hls.on(Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this);
@@ -17737,6 +17748,7 @@ class ID3TrackController {
17737
17748
  hls
17738
17749
  } = this;
17739
17750
  hls.off(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
17751
+ hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
17740
17752
  hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
17741
17753
  hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
17742
17754
  hls.off(Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this);
@@ -17744,7 +17756,6 @@ class ID3TrackController {
17744
17756
  hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
17745
17757
  hls.off(Events.LEVEL_PTS_UPDATED, this.onLevelPtsUpdated, this);
17746
17758
  }
17747
-
17748
17759
  // Add ID3 metatadata text track.
17749
17760
  onMediaAttaching(event, data) {
17750
17761
  var _data$overrides;
@@ -17753,6 +17764,12 @@ class ID3TrackController {
17753
17764
  this.removeCues = false;
17754
17765
  }
17755
17766
  }
17767
+ onMediaAttached() {
17768
+ const details = this.hls.latestLevelDetails;
17769
+ if (details) {
17770
+ this.updateDateRangeCues(details);
17771
+ }
17772
+ }
17756
17773
  onMediaDetaching(event, data) {
17757
17774
  this.media = null;
17758
17775
  const transferringMedia = !!data.transferMedia;
@@ -17761,7 +17778,7 @@ class ID3TrackController {
17761
17778
  }
17762
17779
  if (this.id3Track) {
17763
17780
  if (this.removeCues) {
17764
- clearCurrentCues(this.id3Track);
17781
+ clearCurrentCues(this.id3Track, this.onEventCueEnter);
17765
17782
  }
17766
17783
  this.id3Track = null;
17767
17784
  }
@@ -17923,7 +17940,9 @@ class ID3TrackController {
17923
17940
  delete dateRangeCuesAppended[id];
17924
17941
  Object.keys(cues).forEach(key => {
17925
17942
  try {
17926
- id3Track.removeCue(cues[key]);
17943
+ const cue = cues[key];
17944
+ cue.removeEventListener('enter', this.onEventCueEnter);
17945
+ id3Track.removeCue(cue);
17927
17946
  } catch (e) {
17928
17947
  /* no-op */
17929
17948
  }
@@ -17996,10 +18015,11 @@ class ID3TrackController {
17996
18015
  if (isSCTE35Attribute(key)) {
17997
18016
  data = hexToArrayBuffer(data);
17998
18017
  }
17999
- const _cue = createCueWithDataFields(Cue, startTime, endTime, {
18018
+ const payload = {
18000
18019
  key,
18001
18020
  data
18002
- }, MetadataSchema.dateRange);
18021
+ };
18022
+ const _cue = createCueWithDataFields(Cue, startTime, endTime, payload, MetadataSchema.dateRange);
18003
18023
  if (_cue) {
18004
18024
  _cue.id = id;
18005
18025
  this.id3Track.addCue(_cue);
@@ -19146,7 +19166,7 @@ class GapController extends Logger {
19146
19166
  }
19147
19167
  }
19148
19168
 
19149
- const version = "1.6.0-beta.1.0.canary.10817";
19169
+ const version = "1.6.0-beta.1.0.canary.10819";
19150
19170
 
19151
19171
  // ensure the worker ends up in the bundle
19152
19172
  // If the worker should not be included this gets aliased to empty.js