hls.js 1.5.8-0.canary.10052 → 1.5.8-0.canary.10055

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.mjs CHANGED
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
512
512
  // Some browsers don't allow to use bind on console object anyway
513
513
  // fallback to default if needed
514
514
  try {
515
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.8-0.canary.10052"}`);
515
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.8-0.canary.10055"}`);
516
516
  } catch (e) {
517
517
  /* log fn threw an exception. All logger methods are no-ops. */
518
518
  return createLogger();
@@ -4524,11 +4524,10 @@ class ID3TrackController {
4524
4524
  this.media = data.media;
4525
4525
  }
4526
4526
  onMediaDetaching() {
4527
- if (!this.id3Track) {
4528
- return;
4527
+ if (this.id3Track) {
4528
+ clearCurrentCues(this.id3Track);
4529
+ this.id3Track = null;
4529
4530
  }
4530
- clearCurrentCues(this.id3Track);
4531
- this.id3Track = null;
4532
4531
  this.media = null;
4533
4532
  this.dateRangeCuesAppended = {};
4534
4533
  }
@@ -18760,34 +18759,34 @@ class BufferController extends Logger {
18760
18759
  mediaSource.removeEventListener('startstreaming', this._onStartStreaming);
18761
18760
  mediaSource.removeEventListener('endstreaming', this._onEndStreaming);
18762
18761
  }
18762
+ this.mediaSource = null;
18763
+ this._objectUrl = null;
18764
+ }
18763
18765
 
18764
- // Detach properly the MediaSource from the HTMLMediaElement as
18765
- // suggested in https://github.com/w3c/media-source/issues/53.
18766
- if (media) {
18767
- media.removeEventListener('emptied', this._onMediaEmptied);
18768
- if (_objectUrl) {
18769
- self.URL.revokeObjectURL(_objectUrl);
18770
- }
18766
+ // Detach properly the MediaSource from the HTMLMediaElement as
18767
+ // suggested in https://github.com/w3c/media-source/issues/53.
18768
+ if (media) {
18769
+ media.removeEventListener('emptied', this._onMediaEmptied);
18770
+ if (_objectUrl) {
18771
+ self.URL.revokeObjectURL(_objectUrl);
18772
+ }
18771
18773
 
18772
- // clean up video tag src only if it's our own url. some external libraries might
18773
- // hijack the video tag and change its 'src' without destroying the Hls instance first
18774
- if (this.mediaSrc === _objectUrl) {
18775
- media.removeAttribute('src');
18776
- if (this.appendSource) {
18777
- removeSourceChildren(media);
18778
- }
18779
- media.load();
18780
- } else {
18781
- this.warn('media|source.src was changed by a third party - skip cleanup');
18774
+ // clean up video tag src only if it's our own url. some external libraries might
18775
+ // hijack the video tag and change its 'src' without destroying the Hls instance first
18776
+ if (this.mediaSrc === _objectUrl) {
18777
+ media.removeAttribute('src');
18778
+ if (this.appendSource) {
18779
+ removeSourceChildren(media);
18782
18780
  }
18781
+ media.load();
18782
+ } else {
18783
+ this.warn('media|source.src was changed by a third party - skip cleanup');
18783
18784
  }
18784
- this.mediaSource = null;
18785
18785
  this.media = null;
18786
- this._objectUrl = null;
18787
- this.bufferCodecEventsExpected = this._bufferCodecEventsTotal;
18788
- this.pendingTracks = {};
18789
- this.tracks = {};
18790
18786
  }
18787
+ this.bufferCodecEventsExpected = this._bufferCodecEventsTotal;
18788
+ this.pendingTracks = {};
18789
+ this.tracks = {};
18791
18790
  this.hls.trigger(Events.MEDIA_DETACHED, undefined);
18792
18791
  }
18793
18792
  onBufferReset() {
@@ -21997,7 +21996,7 @@ class TimelineController {
21997
21996
  hls.off(Events.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this);
21998
21997
  hls.off(Events.BUFFER_FLUSHING, this.onBufferFlushing, this);
21999
21998
  // @ts-ignore
22000
- this.hls = this.config = null;
21999
+ this.hls = this.config = this.media = null;
22001
22000
  this.cea608Parser1 = this.cea608Parser2 = undefined;
22002
22001
  }
22003
22002
  initCea608Parsers() {
@@ -22160,6 +22159,7 @@ class TimelineController {
22160
22159
  delete captionsTracks[trackName];
22161
22160
  });
22162
22161
  this.nonNativeCaptionsTracks = {};
22162
+ this.media = null;
22163
22163
  }
22164
22164
  onManifestLoading() {
22165
22165
  // Detect discontinuity in video fragment (CEA-608) parsing
@@ -22820,9 +22820,11 @@ class FPSController {
22820
22820
  }
22821
22821
  registerListeners() {
22822
22822
  this.hls.on(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
22823
+ this.hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
22823
22824
  }
22824
22825
  unregisterListeners() {
22825
22826
  this.hls.off(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
22827
+ this.hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
22826
22828
  }
22827
22829
  destroy() {
22828
22830
  if (this.timer) {
@@ -22844,6 +22846,9 @@ class FPSController {
22844
22846
  this.timer = self.setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);
22845
22847
  }
22846
22848
  }
22849
+ onMediaDetaching() {
22850
+ this.media = null;
22851
+ }
22847
22852
  checkFPS(video, decodedFrames, droppedFrames) {
22848
22853
  const currentTime = performance.now();
22849
22854
  if (decodedFrames) {
@@ -24823,7 +24828,7 @@ class CMCDController {
24823
24828
  // @ts-ignore
24824
24829
  this.hls = this.config = this.audioBuffer = this.videoBuffer = null;
24825
24830
  // @ts-ignore
24826
- this.onWaiting = this.onPlaying = null;
24831
+ this.onWaiting = this.onPlaying = this.media = null;
24827
24832
  }
24828
24833
  onMediaAttached(event, data) {
24829
24834
  this.media = data.media;
@@ -24960,7 +24965,7 @@ class CMCDController {
24960
24965
  * Get the buffer length for a media type in milliseconds
24961
24966
  */
24962
24967
  getBufferLength(type) {
24963
- const media = this.hls.media;
24968
+ const media = this.media;
24964
24969
  const buffer = type === CmObjectType.AUDIO ? this.audioBuffer : this.videoBuffer;
24965
24970
  if (!buffer || !media) {
24966
24971
  return NaN;
@@ -27962,8 +27967,8 @@ class StreamController extends BaseStreamController {
27962
27967
  if (media) {
27963
27968
  media.removeEventListener('playing', this.onMediaPlaying);
27964
27969
  media.removeEventListener('seeked', this.onMediaSeeked);
27965
- this.videoBuffer = null;
27966
27970
  }
27971
+ this.videoBuffer = null;
27967
27972
  this.fragPlaying = null;
27968
27973
  if (this.gapController) {
27969
27974
  this.gapController.destroy();
@@ -28714,7 +28719,7 @@ class Hls {
28714
28719
  * Get the video-dev/hls.js package version.
28715
28720
  */
28716
28721
  static get version() {
28717
- return "1.5.8-0.canary.10052";
28722
+ return "1.5.8-0.canary.10055";
28718
28723
  }
28719
28724
 
28720
28725
  /**