hls.js 1.5.8-0.canary.10054 → 1.5.8-0.canary.10057

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.
@@ -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.10054"}`);
515
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.8-0.canary.10057"}`);
516
516
  } catch (e) {
517
517
  /* log fn threw an exception. All logger methods are no-ops. */
518
518
  return createLogger();
@@ -4040,11 +4040,10 @@ class ID3TrackController {
4040
4040
  this.media = data.media;
4041
4041
  }
4042
4042
  onMediaDetaching() {
4043
- if (!this.id3Track) {
4044
- return;
4043
+ if (this.id3Track) {
4044
+ clearCurrentCues(this.id3Track);
4045
+ this.id3Track = null;
4045
4046
  }
4046
- clearCurrentCues(this.id3Track);
4047
- this.id3Track = null;
4048
4047
  this.media = null;
4049
4048
  this.dateRangeCuesAppended = {};
4050
4049
  }
@@ -7228,34 +7227,34 @@ class BufferController extends Logger {
7228
7227
  mediaSource.removeEventListener('startstreaming', this._onStartStreaming);
7229
7228
  mediaSource.removeEventListener('endstreaming', this._onEndStreaming);
7230
7229
  }
7230
+ this.mediaSource = null;
7231
+ this._objectUrl = null;
7232
+ }
7231
7233
 
7232
- // Detach properly the MediaSource from the HTMLMediaElement as
7233
- // suggested in https://github.com/w3c/media-source/issues/53.
7234
- if (media) {
7235
- media.removeEventListener('emptied', this._onMediaEmptied);
7236
- if (_objectUrl) {
7237
- self.URL.revokeObjectURL(_objectUrl);
7238
- }
7234
+ // Detach properly the MediaSource from the HTMLMediaElement as
7235
+ // suggested in https://github.com/w3c/media-source/issues/53.
7236
+ if (media) {
7237
+ media.removeEventListener('emptied', this._onMediaEmptied);
7238
+ if (_objectUrl) {
7239
+ self.URL.revokeObjectURL(_objectUrl);
7240
+ }
7239
7241
 
7240
- // clean up video tag src only if it's our own url. some external libraries might
7241
- // hijack the video tag and change its 'src' without destroying the Hls instance first
7242
- if (this.mediaSrc === _objectUrl) {
7243
- media.removeAttribute('src');
7244
- if (this.appendSource) {
7245
- removeSourceChildren(media);
7246
- }
7247
- media.load();
7248
- } else {
7249
- this.warn('media|source.src was changed by a third party - skip cleanup');
7242
+ // clean up video tag src only if it's our own url. some external libraries might
7243
+ // hijack the video tag and change its 'src' without destroying the Hls instance first
7244
+ if (this.mediaSrc === _objectUrl) {
7245
+ media.removeAttribute('src');
7246
+ if (this.appendSource) {
7247
+ removeSourceChildren(media);
7250
7248
  }
7249
+ media.load();
7250
+ } else {
7251
+ this.warn('media|source.src was changed by a third party - skip cleanup');
7251
7252
  }
7252
- this.mediaSource = null;
7253
7253
  this.media = null;
7254
- this._objectUrl = null;
7255
- this.bufferCodecEventsExpected = this._bufferCodecEventsTotal;
7256
- this.pendingTracks = {};
7257
- this.tracks = {};
7258
7254
  }
7255
+ this.bufferCodecEventsExpected = this._bufferCodecEventsTotal;
7256
+ this.pendingTracks = {};
7257
+ this.tracks = {};
7259
7258
  this.hls.trigger(Events.MEDIA_DETACHED, undefined);
7260
7259
  }
7261
7260
  onBufferReset() {
@@ -8344,9 +8343,11 @@ class FPSController {
8344
8343
  }
8345
8344
  registerListeners() {
8346
8345
  this.hls.on(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
8346
+ this.hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
8347
8347
  }
8348
8348
  unregisterListeners() {
8349
8349
  this.hls.off(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);
8350
+ this.hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
8350
8351
  }
8351
8352
  destroy() {
8352
8353
  if (this.timer) {
@@ -8368,6 +8369,9 @@ class FPSController {
8368
8369
  this.timer = self.setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);
8369
8370
  }
8370
8371
  }
8372
+ onMediaDetaching() {
8373
+ this.media = null;
8374
+ }
8371
8375
  checkFPS(video, decodedFrames, droppedFrames) {
8372
8376
  const currentTime = performance.now();
8373
8377
  if (decodedFrames) {
@@ -19371,8 +19375,8 @@ class StreamController extends BaseStreamController {
19371
19375
  if (media) {
19372
19376
  media.removeEventListener('playing', this.onMediaPlaying);
19373
19377
  media.removeEventListener('seeked', this.onMediaSeeked);
19374
- this.videoBuffer = null;
19375
19378
  }
19379
+ this.videoBuffer = null;
19376
19380
  this.fragPlaying = null;
19377
19381
  if (this.gapController) {
19378
19382
  this.gapController.destroy();
@@ -20123,7 +20127,7 @@ class Hls {
20123
20127
  * Get the video-dev/hls.js package version.
20124
20128
  */
20125
20129
  static get version() {
20126
- return "1.5.8-0.canary.10054";
20130
+ return "1.5.8-0.canary.10057";
20127
20131
  }
20128
20132
 
20129
20133
  /**