Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (shakaError.code === 1002) {
return 'Shaka request could not be performed for URL ' + shakaError.data[0];
}
if (shakaError.code === 1003) {
return 'Shaka request timed out for URL ' + shakaError.data[0];
}
if (shakaError.message) {
return shakaError.message;
}
if (classification === STREAM_ERROR_DRM_CLIENT_UNAVAILABLE) {
return 'Playback of protected content appears to be disabled in the browser.';
}
if (classification === STREAM_ERROR_DRM_OUTPUT_BLOCKED) {
return 'Playback of protected content appears to be disallowed, perhaps due to a non-secure or HDCP-less screen being connected.';
}
const code = reverseLookup(shakaError.code, shaka.util.Error.Code),
category = reverseLookup(shakaError.category, shaka.util.Error.Category);
const message = 'Shaka error ' + category + '/' + code + ' reported';
if (shakaError.data[0]) {
if (shakaError.data[0].message) {
return message + ': ' + shakaError.data[0].message;
} else {
return message + ': ' + shakaError.data[0];
}
} else {
return message + ' with no further details.';
}
}
const loadStream = function () {
let mpdUrl = Stream.stream().link();
let estimator = new shaka.util.EWMABandwidthEstimator();
let source = new shaka.player.DashVideoSource(mpdUrl, null, estimator);
Stream.player.load(source);
};
return 'Shaka request could not be performed for URL ' + shakaError.data[0];
}
if (shakaError.code === 1003) {
return 'Shaka request timed out for URL ' + shakaError.data[0];
}
if (shakaError.message) {
return shakaError.message;
}
if (classification === STREAM_ERROR_DRM_CLIENT_UNAVAILABLE) {
return 'Playback of protected content appears to be disabled in the browser.';
}
if (classification === STREAM_ERROR_DRM_OUTPUT_BLOCKED) {
return 'Playback of protected content appears to be disallowed, perhaps due to a non-secure or HDCP-less screen being connected.';
}
const code = reverseLookup(shakaError.code, shaka.util.Error.Code),
category = reverseLookup(shakaError.category, shaka.util.Error.Category);
const message = 'Shaka error ' + category + '/' + code + ' reported';
if (shakaError.data[0]) {
if (shakaError.data[0].message) {
return message + ': ' + shakaError.data[0].message;
} else {
return message + ': ' + shakaError.data[0];
}
} else {
return message + ' with no further details.';
}
}
_onError (err) {
const error = {
shakaError: err,
videoError: this.el.error
}
let { category, code, severity } = error.shakaError.detail || error.shakaError
if (error.videoError || !code && !category) return super._onError()
const isCritical = severity === shaka.util.Error.Severity.CRITICAL
const errorData = {
code: `${category}_${code}`,
description: `Category: ${category}, code: ${code}, severity: ${severity}`,
level: isCritical ? PlayerError.Levels.FATAL : PlayerError.Levels.WARN,
raw: err
}
const formattedError = this.createError(errorData)
Log.error('Shaka error event:', formattedError)
this.trigger(Events.PLAYBACK_ERROR, formattedError)
}
.catch(err => {
if (err && err.code !== shaka.util.Error.Code.LOAD_INTERRUPTED) {
throw mapShakaError(false, err, navigator.userAgent, document.location);
}
});
} else if (prevProps && prevProps.source) {