1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #1806 from matjaz321/unavailable-yt-video-trailer-bug-fix

Bug fix for: Cannot exit unavailable/private trailers
This commit is contained in:
Bill Thornton 2020-11-21 15:25:13 -05:00 committed by GitHub
commit b212dbaba7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 6 deletions

View file

@ -2240,13 +2240,14 @@ class PlaybackManager {
const streamInfo = createStreamInfoFromUrlItem(item); const streamInfo = createStreamInfoFromUrlItem(item);
streamInfo.fullscreen = playOptions.fullscreen; streamInfo.fullscreen = playOptions.fullscreen;
getPlayerData(player).isChangingStream = false; getPlayerData(player).isChangingStream = false;
return player.play(streamInfo).then(function () { return player.play(streamInfo).then(() => {
loading.hide(); loading.hide();
onPlaybackStartedFn(); onPlaybackStartedFn();
onPlaybackStarted(player, playOptions, streamInfo); onPlaybackStarted(player, playOptions, streamInfo);
}, function () { }).catch((errorCode) => {
// TODO: show error message
self.stop(player); self.stop(player);
loading.hide();
showPlaybackInfoErrorMessage(self, errorCode || 'ErrorDefault');
}); });
}); });
} }
@ -2935,7 +2936,7 @@ class PlaybackManager {
state.NextMediaType = nextMediaType; state.NextMediaType = nextMediaType;
if (isServerItem(streamInfo.item)) { if (streamInfo && isServerItem(streamInfo.item)) {
if (player.supportsProgress === false && state.PlayState && !state.PlayState.PositionTicks) { if (player.supportsProgress === false && state.PlayState && !state.PlayState.PositionTicks) {
state.PlayState.PositionTicks = streamInfo.item.RunTimeTicks; state.PlayState.PositionTicks = streamInfo.item.RunTimeTicks;
} }

View file

@ -5,6 +5,14 @@ import loading from '../../components/loading/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 },
@ -139,7 +147,8 @@ function setCurrentSrc(instance, elem, options) {
} else if (event.data === YT.PlayerState.PAUSED) { } else if (event.data === YT.PlayerState.PAUSED) {
Events.trigger(instance, 'pause'); Events.trigger(instance, 'pause');
} }
} },
'onError': (e) => reject(errorCodes[e.data] || 'ErrorDefault')
}, },
playerVars: { playerVars: {
controls: 0, controls: 0,

View file

@ -1449,5 +1449,9 @@
"LabelAllowedAudioChannels": "Maximum Allowed Audio Channels", "LabelAllowedAudioChannels": "Maximum Allowed Audio Channels",
"LabelSelectAudioChannels": "Channels", "LabelSelectAudioChannels": "Channels",
"LabelSelectMono": "Mono", "LabelSelectMono": "Mono",
"LabelSelectStereo": "Stereo" "LabelSelectStereo": "Stereo",
"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."
} }