Skip to content

feat: support more key system error detail #6807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/controller/eme-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`),
});
}),
),
)
Expand All @@ -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}`,
),
});
});
}

Expand Down Expand Up @@ -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}`),
});
});
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Loading