Skip to content

Commit

Permalink
remove extra error function
Browse files Browse the repository at this point in the history
  • Loading branch information
adrums86 committed Feb 28, 2024
1 parent 137809a commit f2a96a0
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,13 @@ export const setupSessions = (player) => {
*/
export const emeErrorHandler = (player) => {
return (objOrErr) => {
const vjsErrorType = videojs.Error && videojs.Error.EMEKeySessionCreationError;
const errorType = vjsErrorType || 'eme-key-session-creation-error';
const error = {
// MEDIA_ERR_ENCRYPTED is code 5
code: 5
code: 5,
errorType
};
const vjsErrorType = videojs.Error && videojs.Error.EMEKeySessionCreationError;
const errorType = vjsErrorType || 'eme-key-session-creation-error';

if (typeof objOrErr === 'string') {
error.message = objOrErr;
Expand All @@ -209,10 +210,7 @@ export const emeErrorHandler = (player) => {
}

player.error(error);
player.eme.error({
errorType,
error
});
player.trigger('vjsemeerror');
};
};

Expand Down Expand Up @@ -410,27 +408,7 @@ const eme = function(options = {}) {
});
},
detectSupportedCDMs,
options,
_error: null,
error(err) {

// If `err` doesn't exist, return the current error.
if (err === undefined) {
return this._error || null;
}

// If `err` is null, reset the ads error.
if (err === null) {
this._error = null;

return;
}

this._error = err;

videojs.log.error(`EME error occured of type: ${err.errorType}.`);
player.trigger('vjsemeerror');
}
options
};
};

Expand Down

0 comments on commit f2a96a0

Please sign in to comment.