mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add playback error messages and fix error propogation
This commit is contained in:
parent
15d30ffaeb
commit
5a5a70dad0
4 changed files with 26 additions and 14 deletions
|
@ -190,7 +190,7 @@ export function playWithPromise(elem, onErrorFn) {
|
||||||
// swallow this error because the user can still click the play button on the video element
|
// swallow this error because the user can still click the play button on the video element
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
return Promise.reject();
|
return Promise.reject(e);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
onSuccessfulPlay(elem, onErrorFn);
|
onSuccessfulPlay(elem, onErrorFn);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { getItems } from '../../utils/jellyfin-apiclient/getItems.ts';
|
||||||
import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdropImage';
|
import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdropImage';
|
||||||
|
|
||||||
import { MediaError } from 'types/mediaError';
|
import { MediaError } from 'types/mediaError';
|
||||||
|
import { getMediaError } from 'utils/mediaError';
|
||||||
|
|
||||||
const UNLIMITED_ITEMS = -1;
|
const UNLIMITED_ITEMS = -1;
|
||||||
|
|
||||||
|
@ -1781,7 +1782,7 @@ class PlaybackManager {
|
||||||
playerData.isChangingStream = false;
|
playerData.isChangingStream = false;
|
||||||
|
|
||||||
onPlaybackError.call(player, e, {
|
onPlaybackError.call(player, e, {
|
||||||
type: MediaError.PLAYER_ERROR,
|
type: getMediaError(e),
|
||||||
streamInfo: streamInfo
|
streamInfo: streamInfo
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2564,7 +2565,7 @@ class PlaybackManager {
|
||||||
onPlaybackStarted(player, playOptions, streamInfo, mediaSource);
|
onPlaybackStarted(player, playOptions, streamInfo, mediaSource);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
onPlaybackError.call(player, err, {
|
onPlaybackError.call(player, err, {
|
||||||
type: MediaError.PLAYER_ERROR,
|
type: getMediaError(err),
|
||||||
streamInfo
|
streamInfo
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
|
@ -3232,7 +3233,7 @@ class PlaybackManager {
|
||||||
|
|
||||||
const errorType = error.type;
|
const errorType = error.type;
|
||||||
|
|
||||||
console.warn('[playbackmanager] onPlaybackError:', error);
|
console.warn('[playbackmanager] onPlaybackError:', e, error);
|
||||||
|
|
||||||
const streamInfo = error.streamInfo || getPlayerData(player).streamInfo;
|
const streamInfo = error.streamInfo || getPlayerData(player).streamInfo;
|
||||||
|
|
||||||
|
|
|
@ -1228,16 +1228,16 @@
|
||||||
"Play": "Play",
|
"Play": "Play",
|
||||||
"PlayAllFromHere": "Play all from here",
|
"PlayAllFromHere": "Play all from here",
|
||||||
"PlaybackData": "Playback Info",
|
"PlaybackData": "Playback Info",
|
||||||
"PlaybackError.ASS_RENDER_ERROR": "",
|
"PlaybackError.ASS_RENDER_ERROR": "An error was encountered in the ASS/SSA subtitle renderer.",
|
||||||
"PlaybackError.FATAL_HLS_ERROR": "",
|
"PlaybackError.FATAL_HLS_ERROR": "A fatal error was encountered in the HLS stream.",
|
||||||
"PlaybackError.MEDIA_DECODE_ERROR": "",
|
"PlaybackError.MEDIA_DECODE_ERROR": "Playback failed due to an error decoding the media.",
|
||||||
"PlaybackError.MEDIA_NOT_SUPPORTED": "",
|
"PlaybackError.MEDIA_NOT_SUPPORTED": "Playback failed because the media is not supported by this client.",
|
||||||
"PlaybackError.NETWORK_ERROR": "",
|
"PlaybackError.NETWORK_ERROR": "Playback failed due to a network error.",
|
||||||
"PlaybackError.NO_MEDIA_ERROR": "",
|
"PlaybackError.NO_MEDIA_ERROR": "Unable to find a valid media source to play.",
|
||||||
"PlaybackError.PLAYER_ERROR": "",
|
"PlaybackError.PLAYER_ERROR": "Playback failed due to a fatal player error.",
|
||||||
"PlaybackError.SERVER_ERROR": "",
|
"PlaybackError.SERVER_ERROR": "Playback failed due to a server error.",
|
||||||
"PlaybackError.NotAllowed": "",
|
"PlaybackError.NotAllowed": "Playback of this media is not allowed.",
|
||||||
"PlaybackError.RateLimitExceeded": "",
|
"PlaybackError.RateLimitExceeded": "This media cannot be played at this time due to rate limits.",
|
||||||
"PlaybackErrorNoCompatibleStream": "This client isn't compatible with the media and the server isn't sending a compatible media format.",
|
"PlaybackErrorNoCompatibleStream": "This client isn't compatible with the media and the server isn't sending a compatible media format.",
|
||||||
"PlaybackErrorPlaceHolder": "This is a placeholder for physical media that Jellyfin cannot play. Please insert the disc to play.",
|
"PlaybackErrorPlaceHolder": "This is a placeholder for physical media that Jellyfin cannot play. Please insert the disc to play.",
|
||||||
"PlaybackRate": "Playback Speed",
|
"PlaybackRate": "Playback Speed",
|
||||||
|
|
11
src/utils/mediaError.ts
Normal file
11
src/utils/mediaError.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { MediaError } from 'types/mediaError';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps a DOMException name to an equivalent {@link MediaError}.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException#error_names
|
||||||
|
*/
|
||||||
|
export function getMediaError(e?: DOMException): MediaError {
|
||||||
|
if (e?.name === 'NotSupportedError') return MediaError.MEDIA_NOT_SUPPORTED;
|
||||||
|
return MediaError.PLAYER_ERROR;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue