diff --git a/src/routes/Player/Video/stremio-video/HTMLSubtitles.js b/src/routes/Player/Video/stremio-video/HTMLSubtitles.js index fb9b4ab24..5cb3f1f98 100644 --- a/src/routes/Player/Video/stremio-video/HTMLSubtitles.js +++ b/src/routes/Player/Video/stremio-video/HTMLSubtitles.js @@ -76,7 +76,7 @@ function HTMLSubtitles(containerElement) { }) .catch(function() { events.emit('error', Object.freeze({ - code: 70, + code: HTMLSubtitles.ERROR.SUBTITLES_FETCH_FAILED, track: track })); }) @@ -90,7 +90,7 @@ function HTMLSubtitles(containerElement) { }) .catch(function() { events.emit('error', Object.freeze({ - code: 71, + code: HTMLSubtitles.ERROR.SUBTITLES_PARSE_FAILED, track: track })); }); @@ -186,6 +186,11 @@ function HTMLSubtitles(containerElement) { Object.freeze(this); }; +HTMLSubtitles.ERROR = Object.freeze({ + SUBTITLES_FETCH_FAILED: 70, + SUBTITLES_PARSE_FAILED: 71 +}); + Object.freeze(HTMLSubtitles); module.exports = HTMLSubtitles; diff --git a/src/routes/Player/Video/stremio-video/YouTubeVideo.js b/src/routes/Player/Video/stremio-video/YouTubeVideo.js index dace7dc0d..556fad779 100644 --- a/src/routes/Player/Video/stremio-video/YouTubeVideo.js +++ b/src/routes/Player/Video/stremio-video/YouTubeVideo.js @@ -150,20 +150,24 @@ function YouTubeVideo(containerElement) { events.emit('propChanged', 'subtitleDarkBackground', getSubtitleDarkBackground()); } function onSubtitlesError(error) { + var code; var message; switch (error.code) { - case 70: + case HTMLSubtitles.ERROR.SUBTITLES_FETCH_FAILED: + code = HTMLSubtitles.ERROR.SUBTITLES_FETCH_FAILED; message = 'Failed to fetch subtitles from ' + error.track.origin; break; - case 71: + case HTMLSubtitles.ERROR.SUBTITLES_PARSE_FAILED: + code = HTMLSubtitles.ERROR.SUBTITLES_PARSE_FAILED; message = 'Failed to parse subtitles from ' + error.track.origin; break; default: + code = -1; message = 'Unknown subtitles error'; } onError({ - code: error.code, + code: code, message: message, critical: false }); @@ -535,6 +539,10 @@ function YouTubeVideo(containerElement) { Object.freeze(this); }; +YouTubeVideo.error = Object.freeze({ + +}); + YouTubeVideo.manifest = Object.freeze({ name: 'YouTubeVideo', embedded: true,