diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 54831094e1..dcb9479674 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2244,10 +2244,10 @@ class PlaybackManager { loading.hide(); onPlaybackStartedFn(); onPlaybackStarted(player, playOptions, streamInfo); - }).catch(() => { - // TODO: show error message + }).catch((errorCode) => { self.stop(player); loading.hide(); + showPlaybackInfoErrorMessage(self, errorCode || ''); }); }); } diff --git a/src/plugins/youtubePlayer/plugin.js b/src/plugins/youtubePlayer/plugin.js index 9079e2bcb6..2976f52e57 100644 --- a/src/plugins/youtubePlayer/plugin.js +++ b/src/plugins/youtubePlayer/plugin.js @@ -5,6 +5,14 @@ import loading from 'loading'; /* globals YT */ +const errorCodes = { + 2: 'YoutubeBadRequest', + 5: 'YoutubePlaybackError', + 100: 'YoutubeNotFound', + 101: 'YoutubeDenied', + 150: 'YoutubeDenied' +}; + function zoomIn(elem, iterations) { const keyframes = [ { transform: 'scale3d(.2, .2, .2) ', opacity: '.6', offset: 0 }, @@ -143,7 +151,7 @@ function setCurrentSrc(instance, elem, options) { events.trigger(instance, 'pause'); } }, - 'onError': () => reject() + 'onError': (e) => reject(errorCodes[e.data] || '') // FIXME: default error code/text? }, playerVars: { controls: 0, diff --git a/src/strings/en-us.json b/src/strings/en-us.json index ab547f3854..a5a2279bdd 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -1421,5 +1421,9 @@ "SubtitleVerticalPositionHelp": "Line number where text appears. Positive numbers indicate top down. Negative numbers indicate bottom up.", "Preview": "Preview", "LabelMaxMuxingQueueSize": "Max muxing queue size:", - "LabelMaxMuxingQueueSizeHelp": "Maximum number of packets that can be buffered while waiting for all streams to initialize. Try to increase it if you still encounter \"Too many packets buffered for output stream\" error in ffmpeg logs. The recommended value is 2048." + "LabelMaxMuxingQueueSizeHelp": "Maximum number of packets that can be buffered while waiting for all streams to initialize. Try to increase it if you still encounter \"Too many packets buffered for output stream\" error in ffmpeg logs. The recommended value is 2048.", + "YoutubeBadRequest": "Bad request.", + "YoutubePlaybackError": "Requested video cannot be played.", + "YoutubeNotFound": "Video not found.", + "YoutubeDenied": "Requested video is not allowed to be played in embedded players." }