Uncaught TypeError: Cannot read property 'msExtendedCode' of null
Created by: abuisine
Steps to reproduce
- Open content which is not correctly supported by the device
Observed behaviour
msExtendedCode should not be called on a non existing error object
Good management of a null error object at the beginning of the function
function onPlaybackError(e) {
var code = e.error ? e.error.code : 0;
var msg = '';
if (code === -1) {
// not an error!
return;
}
switch (code) {
case 1:
msg = 'MEDIA_ERR_ABORTED';
break;
case 2:
msg = 'MEDIA_ERR_NETWORK';
break;
case 3:
msg = 'MEDIA_ERR_DECODE';
break;
case 4:
msg = 'MEDIA_ERR_SRC_NOT_SUPPORTED';
break;
case 5:
msg = 'MEDIA_ERR_ENCRYPTED';
break;
default:
msg = 'UNKNOWN';
break;
}
hasMediaError = true;
Missing management of a null error object here
if (e.error.msExtendedCode) {
msg += ' (0x' + (e.error.msExtendedCode >>> 0).toString(16).toUpperCase() + ')';
}
log('Video Element Error: ' + msg);
if (e.error) {
log(e.error);
}
errHandler.mediaSourceError(msg);
reset();
}