diff --git a/api-extractor/report/hls.js.api.md b/api-extractor/report/hls.js.api.md index fbded3802e2..2838c2c2fdd 100644 --- a/api-extractor/report/hls.js.api.md +++ b/api-extractor/report/hls.js.api.md @@ -1311,6 +1311,12 @@ export enum ErrorDetails { // (undocumented) KEY_LOAD_TIMEOUT = "keyLoadTimeOut", // (undocumented) + KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR = "keySystemDestroyCloseSessionError", + // (undocumented) + KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR = "keySystemDestroyMediaKeysError", + // (undocumented) + KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR = "keySystemDestroyRemoveSessionError", + // (undocumented) KEY_SYSTEM_LICENSE_REQUEST_FAILED = "keySystemLicenseRequestFailed", // (undocumented) KEY_SYSTEM_NO_ACCESS = "keySystemNoAccess", diff --git a/src/controller/eme-controller.ts b/src/controller/eme-controller.ts index ecdfc9e1660..85d0921e1ef 100644 --- a/src/controller/eme-controller.ts +++ b/src/controller/eme-controller.ts @@ -1266,6 +1266,12 @@ class EMEController extends Logger implements ComponentAPI { .concat( media?.setMediaKeys(null)?.catch((error) => { this.log(`Could not clear media keys: ${error}`); + this.hls?.trigger(Events.ERROR, { + type: ErrorTypes.OTHER_ERROR, + details: ErrorDetails.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR, + fatal: false, + error: new Error(`Could not clear media keys: ${error}`), + }); }), ), ) @@ -1277,6 +1283,14 @@ class EMEController extends Logger implements ComponentAPI { }) .catch((error) => { this.log(`Could not close sessions and clear media keys: ${error}`); + this.hls?.trigger(Events.ERROR, { + type: ErrorTypes.OTHER_ERROR, + details: ErrorDetails.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR, + fatal: false, + error: new Error( + `Could not close sessions and clear media keys: ${error}`, + ), + }); }); } @@ -1348,12 +1362,24 @@ class EMEController extends Logger implements ComponentAPI { .remove() .catch((error) => { this.log(`Could not remove session: ${error}`); + this.hls?.trigger(Events.ERROR, { + type: ErrorTypes.OTHER_ERROR, + details: ErrorDetails.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR, + fatal: false, + error: new Error(`Could not remove session: ${error}`), + }); }) .then(() => { return mediaKeysSession.close(); }) .catch((error) => { this.log(`Could not close session: ${error}`); + this.hls?.trigger(Events.ERROR, { + type: ErrorTypes.OTHER_ERROR, + details: ErrorDetails.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR, + fatal: false, + error: new Error(`Could not close session: ${error}`), + }); }); } } diff --git a/src/errors.ts b/src/errors.ts index 1d97937d608..d6f58661229 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -22,6 +22,9 @@ export enum ErrorDetails { KEY_SYSTEM_SESSION_UPDATE_FAILED = 'keySystemSessionUpdateFailed', KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED = 'keySystemStatusOutputRestricted', KEY_SYSTEM_STATUS_INTERNAL_ERROR = 'keySystemStatusInternalError', + KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR = 'keySystemDestroyMediaKeysError', + KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR = 'keySystemDestroyCloseSessionError', + KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR = 'keySystemDestroyRemoveSessionError', // Identifier for a manifest load error - data: { url : faulty URL, response : { code: error code, text: error text }} MANIFEST_LOAD_ERROR = 'manifestLoadError', // Identifier for a manifest load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}