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();
onPlaybackStartedFn();
onPlaybackStarted(player, playOptions, streamInfo);
}).catch(() => {
// TODO: show error message
}).catch((errorCode) => {
self.stop(player);
loading.hide();
showPlaybackInfoErrorMessage(self, errorCode || '');
});
});
}

View File

@ -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,

View File

@ -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."
}