hls.js 1.6.3-0.canary.11262 → 1.6.3

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.d.mts CHANGED
@@ -997,6 +997,7 @@ export declare class EMEController extends Logger implements ComponentAPI {
997
997
  private unpackPlayReadyKeyMessage;
998
998
  private setupLicenseXHR;
999
999
  private requestLicense;
1000
+ private onDestroying;
1000
1001
  private onMediaAttached;
1001
1002
  private onMediaDetached;
1002
1003
  private _clear;
package/dist/hls.d.ts CHANGED
@@ -997,6 +997,7 @@ export declare class EMEController extends Logger implements ComponentAPI {
997
997
  private unpackPlayReadyKeyMessage;
998
998
  private setupLicenseXHR;
999
999
  private requestLicense;
1000
+ private onDestroying;
1000
1001
  private onMediaAttached;
1001
1002
  private onMediaDetached;
1002
1003
  private _clear;
package/dist/hls.js CHANGED
@@ -1165,7 +1165,7 @@
1165
1165
  // Some browsers don't allow to use bind on console object anyway
1166
1166
  // fallback to default if needed
1167
1167
  try {
1168
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.3-0.canary.11262");
1168
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.3");
1169
1169
  } catch (e) {
1170
1170
  /* log fn threw an exception. All logger methods are no-ops. */
1171
1171
  return createLogger();
@@ -16674,7 +16674,7 @@
16674
16674
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16675
16675
  }
16676
16676
 
16677
- var version = "1.6.3-0.canary.11262";
16677
+ var version = "1.6.3";
16678
16678
 
16679
16679
  // ensure the worker ends up in the bundle
16680
16680
  // If the worker should not be included this gets aliased to empty.js
@@ -22233,6 +22233,14 @@
22233
22233
  return url.href;
22234
22234
  }
22235
22235
 
22236
+ function addEventListener(el, type, listener) {
22237
+ removeEventListener(el, type, listener);
22238
+ el.addEventListener(type, listener);
22239
+ }
22240
+ function removeEventListener(el, type, listener) {
22241
+ el.removeEventListener(type, listener);
22242
+ }
22243
+
22236
22244
  /**
22237
22245
  * Controller to deal with encrypted media extensions (EME)
22238
22246
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API
@@ -22413,10 +22421,8 @@
22413
22421
  _inheritsLoose(EMEController, _Logger);
22414
22422
  var _proto = EMEController.prototype;
22415
22423
  _proto.destroy = function destroy() {
22416
- var media = this.media;
22417
- this.unregisterListeners();
22424
+ this.onDestroying();
22418
22425
  this.onMediaDetached();
22419
- this._clear(media);
22420
22426
  // Remove any references that could be held in config options or callbacks
22421
22427
  var config = this.config;
22422
22428
  config.requestMediaKeySystemAccessFunc = null;
@@ -22432,12 +22438,14 @@
22432
22438
  this.hls.on(Events.MEDIA_DETACHED, this.onMediaDetached, this);
22433
22439
  this.hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
22434
22440
  this.hls.on(Events.MANIFEST_LOADED, this.onManifestLoaded, this);
22441
+ this.hls.on(Events.DESTROYING, this.onDestroying, this);
22435
22442
  };
22436
22443
  _proto.unregisterListeners = function unregisterListeners() {
22437
22444
  this.hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
22438
22445
  this.hls.off(Events.MEDIA_DETACHED, this.onMediaDetached, this);
22439
22446
  this.hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
22440
22447
  this.hls.off(Events.MANIFEST_LOADED, this.onManifestLoaded, this);
22448
+ this.hls.off(Events.DESTROYING, this.onDestroying, this);
22441
22449
  };
22442
22450
  _proto.getLicenseServerUrl = function getLicenseServerUrl(keySystem) {
22443
22451
  var _this$config = this.config,
@@ -22831,8 +22839,8 @@
22831
22839
  _this0.renewKeySession(context);
22832
22840
  }
22833
22841
  };
22834
- context.mediaKeysSession.addEventListener('message', onmessage);
22835
- context.mediaKeysSession.addEventListener('keystatuseschange', onkeystatuseschange);
22842
+ addEventListener(context.mediaKeysSession, 'message', onmessage);
22843
+ addEventListener(context.mediaKeysSession, 'keystatuseschange', onkeystatuseschange);
22836
22844
  var keyUsablePromise = new Promise(function (resolve, reject) {
22837
22845
  licenseStatus.on('error', reject);
22838
22846
  licenseStatus.on('keyStatus', function (keyStatus) {
@@ -23115,6 +23123,10 @@
23115
23123
  });
23116
23124
  });
23117
23125
  };
23126
+ _proto.onDestroying = function onDestroying() {
23127
+ this.unregisterListeners();
23128
+ this._clear();
23129
+ };
23118
23130
  _proto.onMediaAttached = function onMediaAttached(event, data) {
23119
23131
  if (!this.config.emeEnabled) {
23120
23132
  return;
@@ -23123,29 +23135,30 @@
23123
23135
 
23124
23136
  // keep reference of media
23125
23137
  this.media = media;
23126
- media.removeEventListener('encrypted', this.onMediaEncrypted);
23127
- media.removeEventListener('waitingforkey', this.onWaitingForKey);
23128
- media.addEventListener('encrypted', this.onMediaEncrypted);
23129
- media.addEventListener('waitingforkey', this.onWaitingForKey);
23138
+ addEventListener(media, 'encrypted', this.onMediaEncrypted);
23139
+ addEventListener(media, 'waitingforkey', this.onWaitingForKey);
23130
23140
  };
23131
23141
  _proto.onMediaDetached = function onMediaDetached() {
23132
23142
  var media = this.media;
23133
23143
  if (media) {
23134
- media.removeEventListener('encrypted', this.onMediaEncrypted);
23135
- media.removeEventListener('waitingforkey', this.onWaitingForKey);
23144
+ removeEventListener(media, 'encrypted', this.onMediaEncrypted);
23145
+ removeEventListener(media, 'waitingforkey', this.onWaitingForKey);
23136
23146
  this.media = null;
23137
23147
  this.mediaKeys = null;
23138
23148
  }
23139
23149
  };
23140
- _proto._clear = function _clear(media) {
23150
+ _proto._clear = function _clear() {
23141
23151
  var _this14 = this,
23142
23152
  _media$setMediaKeys;
23143
- var mediaKeysList = this.mediaKeySessions;
23144
23153
  this._requestLicenseFailureCount = 0;
23145
- this.mediaKeys = null;
23146
- this.setMediaKeysQueue = [];
23147
- this.mediaKeySessions = [];
23148
23154
  this.keyIdToKeySessionPromise = {};
23155
+ if (!this.mediaKeys && !this.mediaKeySessions.length) {
23156
+ return;
23157
+ }
23158
+ var media = this.media;
23159
+ var mediaKeysList = this.mediaKeySessions.slice();
23160
+ this.mediaKeySessions = [];
23161
+ this.mediaKeys = null;
23149
23162
  LevelKey.clearKeyUriToKeyIdMap();
23150
23163
 
23151
23164
  // Close all sessions and remove media keys from the video element.
@@ -23161,12 +23174,7 @@
23161
23174
  fatal: false,
23162
23175
  error: new Error("Could not clear media keys: " + error)
23163
23176
  });
23164
- }))).then(function () {
23165
- if (keySessionCount) {
23166
- _this14.log('finished closing key sessions and clearing media keys');
23167
- mediaKeysList.length = 0;
23168
- }
23169
- }).catch(function (error) {
23177
+ }))).catch(function (error) {
23170
23178
  var _this14$hls2;
23171
23179
  _this14.log("Could not close sessions and clear media keys: " + error);
23172
23180
  (_this14$hls2 = _this14.hls) == null ? void 0 : _this14$hls2.trigger(Events.ERROR, {
@@ -23175,6 +23183,10 @@
23175
23183
  fatal: false,
23176
23184
  error: new Error("Could not close sessions and clear media keys: " + error)
23177
23185
  });
23186
+ }).then(function () {
23187
+ if (keySessionCount) {
23188
+ _this14.log('finished closing key sessions and clearing media keys');
23189
+ }
23178
23190
  });
23179
23191
  };
23180
23192
  _proto.onManifestLoading = function onManifestLoading() {
@@ -24514,14 +24526,6 @@
24514
24526
  return AssetListLoader;
24515
24527
  }();
24516
24528
 
24517
- function addEventListener(el, type, listener) {
24518
- removeEventListener(el, type, listener);
24519
- el.addEventListener(type, listener);
24520
- }
24521
- function removeEventListener(el, type, listener) {
24522
- el.removeEventListener(type, listener);
24523
- }
24524
-
24525
24529
  function playWithCatch(media) {
24526
24530
  media == null ? void 0 : media.play().catch(function () {
24527
24531
  /* no-op */
package/dist/hls.js.d.ts CHANGED
@@ -997,6 +997,7 @@ export declare class EMEController extends Logger implements ComponentAPI {
997
997
  private unpackPlayReadyKeyMessage;
998
998
  private setupLicenseXHR;
999
999
  private requestLicense;
1000
+ private onDestroying;
1000
1001
  private onMediaAttached;
1001
1002
  private onMediaDetached;
1002
1003
  private _clear;