Add error message

This commit is contained in:
Dmitry Lyzo 2020-10-29 23:52:52 +03:00
parent f805bef9e5
commit 6aa0d7c318
3 changed files with 16 additions and 4 deletions

View File

@ -2244,10 +2244,10 @@ class PlaybackManager {
loading.hide(); loading.hide();
onPlaybackStartedFn(); onPlaybackStartedFn();
onPlaybackStarted(player, playOptions, streamInfo); onPlaybackStarted(player, playOptions, streamInfo);
}).catch(() => { }).catch((errorCode) => {
// TODO: show error message
self.stop(player); self.stop(player);
loading.hide(); loading.hide();
showPlaybackInfoErrorMessage(self, errorCode || '');
}); });
}); });
} }

View File

@ -5,6 +5,14 @@ import loading from 'loading';
/* globals YT */ /* globals YT */
const errorCodes = {
2: 'YoutubeBadRequest',
5: 'YoutubePlaybackError',
100: 'YoutubeNotFound',
101: 'YoutubeDenied',
150: 'YoutubeDenied'
};
function zoomIn(elem, iterations) { function zoomIn(elem, iterations) {
const keyframes = [ const keyframes = [
{ transform: 'scale3d(.2, .2, .2) ', opacity: '.6', offset: 0 }, { transform: 'scale3d(.2, .2, .2) ', opacity: '.6', offset: 0 },
@ -143,7 +151,7 @@ function setCurrentSrc(instance, elem, options) {
events.trigger(instance, 'pause'); events.trigger(instance, 'pause');
} }
}, },
'onError': () => reject() 'onError': (e) => reject(errorCodes[e.data] || '') // FIXME: default error code/text?
}, },
playerVars: { playerVars: {
controls: 0, controls: 0,

View File

@ -1421,5 +1421,9 @@
"SubtitleVerticalPositionHelp": "Line number where text appears. Positive numbers indicate top down. Negative numbers indicate bottom up.", "SubtitleVerticalPositionHelp": "Line number where text appears. Positive numbers indicate top down. Negative numbers indicate bottom up.",
"Preview": "Preview", "Preview": "Preview",
"LabelMaxMuxingQueueSize": "Max muxing queue size:", "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."
} }