mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add new media error types
This commit is contained in:
parent
081d408b18
commit
15d30ffaeb
5 changed files with 39 additions and 20 deletions
|
@ -88,7 +88,7 @@ export function handleHlsJsMediaError(instance, reject) {
|
||||||
if (reject) {
|
if (reject) {
|
||||||
reject();
|
reject();
|
||||||
} else {
|
} else {
|
||||||
onErrorInternal(instance, MediaError.MEDIA_DECODE_ERROR);
|
onErrorInternal(instance, MediaError.FATAL_HLS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,11 +99,7 @@ export function onErrorInternal(instance, type) {
|
||||||
instance.destroyCustomTrack(instance._mediaElement);
|
instance.destroyCustomTrack(instance._mediaElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.trigger(instance, 'error', [
|
Events.trigger(instance, 'error', [{ type }]);
|
||||||
{
|
|
||||||
type: type
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isValidDuration(duration) {
|
export function isValidDuration(duration) {
|
||||||
|
@ -319,7 +315,7 @@ export function bindEventsToHlsPlayer(instance, hls, elem, onErrorFn, resolve, r
|
||||||
reject();
|
reject();
|
||||||
reject = null;
|
reject = null;
|
||||||
} else {
|
} else {
|
||||||
onErrorInternal(instance, MediaError.MEDIA_DECODE_ERROR);
|
onErrorInternal(instance, MediaError.FATAL_HLS_ERROR);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { PlaybackErrorCode } from '@jellyfin/sdk/lib/generated-client/models/playback-error-code.js';
|
||||||
import merge from 'lodash-es/merge';
|
import merge from 'lodash-es/merge';
|
||||||
import Screenfull from 'screenfull';
|
import Screenfull from 'screenfull';
|
||||||
|
|
||||||
|
@ -591,9 +592,18 @@ function supportsDirectPlay(apiClient, item, mediaSource) {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {PlaybackManager} instance
|
||||||
|
* @param {import('@jellyfin/sdk/lib/generated-client/index.js').PlaybackInfoResponse} result
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
function validatePlaybackInfoResult(instance, result) {
|
function validatePlaybackInfoResult(instance, result) {
|
||||||
if (result.ErrorCode) {
|
if (result.ErrorCode) {
|
||||||
showPlaybackInfoErrorMessage(instance, 'PlaybackError' + result.ErrorCode);
|
// NOTE: To avoid needing to retranslate the "NoCompatibleStream" message,
|
||||||
|
// we need to keep the key in the same format.
|
||||||
|
const errMessage = result.ErrorCode === PlaybackErrorCode.NoCompatibleStream ?
|
||||||
|
'PlaybackErrorNoCompatibleStream' : `PlaybackError.${result.ErrorCode}`;
|
||||||
|
showPlaybackInfoErrorMessage(instance, errMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1723,7 +1733,7 @@ class PlaybackManager {
|
||||||
streamInfo.resetSubtitleOffset = false;
|
streamInfo.resetSubtitleOffset = false;
|
||||||
|
|
||||||
if (!streamInfo.url) {
|
if (!streamInfo.url) {
|
||||||
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
|
showPlaybackInfoErrorMessage(self, `PlaybackError.${MediaError.NO_MEDIA_ERROR}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1771,7 +1781,7 @@ class PlaybackManager {
|
||||||
playerData.isChangingStream = false;
|
playerData.isChangingStream = false;
|
||||||
|
|
||||||
onPlaybackError.call(player, e, {
|
onPlaybackError.call(player, e, {
|
||||||
type: MediaError.MEDIA_DECODE_ERROR,
|
type: MediaError.PLAYER_ERROR,
|
||||||
streamInfo: streamInfo
|
streamInfo: streamInfo
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2182,7 +2192,7 @@ class PlaybackManager {
|
||||||
|
|
||||||
// If it's still null then there's nothing to play
|
// If it's still null then there's nothing to play
|
||||||
if (!firstItem) {
|
if (!firstItem) {
|
||||||
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
|
showPlaybackInfoErrorMessage(self, `PlaybackError.${MediaError.NO_MEDIA_ERROR}`);
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2554,7 +2564,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.MEDIA_DECODE_ERROR,
|
type: MediaError.PLAYER_ERROR,
|
||||||
streamInfo
|
streamInfo
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
|
@ -2788,7 +2798,7 @@ class PlaybackManager {
|
||||||
return mediaSource;
|
return mediaSource;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
|
showPlaybackInfoErrorMessage(self, `PlaybackError.${MediaError.NO_MEDIA_ERROR}`);
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1022,8 +1022,7 @@ export class HtmlVideoPlayer {
|
||||||
// Only trigger this if there is media info
|
// Only trigger this if there is media info
|
||||||
// Avoid triggering in situations where it might not actually have a video stream (audio only live tv channel)
|
// Avoid triggering in situations where it might not actually have a video stream (audio only live tv channel)
|
||||||
if (!mediaSource || mediaSource.RunTimeTicks) {
|
if (!mediaSource || mediaSource.RunTimeTicks) {
|
||||||
// FIXME: This shouldn't really be a decode error...
|
onErrorInternal(this, MediaError.NO_MEDIA_ERROR);
|
||||||
onErrorInternal(this, MediaError.MEDIA_DECODE_ERROR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1279,7 +1278,7 @@ export class HtmlVideoPlayer {
|
||||||
// HACK: Give JavascriptSubtitlesOctopus time to dispose itself
|
// HACK: Give JavascriptSubtitlesOctopus time to dispose itself
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// FIXME: Probably not a decode error...
|
// FIXME: Probably not a decode error...
|
||||||
onErrorInternal(this, MediaError.MEDIA_DECODE_ERROR);
|
onErrorInternal(this, MediaError.ASS_RENDER_ERROR);
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000,
|
timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000,
|
||||||
|
|
|
@ -1228,6 +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.FATAL_HLS_ERROR": "",
|
||||||
|
"PlaybackError.MEDIA_DECODE_ERROR": "",
|
||||||
|
"PlaybackError.MEDIA_NOT_SUPPORTED": "",
|
||||||
|
"PlaybackError.NETWORK_ERROR": "",
|
||||||
|
"PlaybackError.NO_MEDIA_ERROR": "",
|
||||||
|
"PlaybackError.PLAYER_ERROR": "",
|
||||||
|
"PlaybackError.SERVER_ERROR": "",
|
||||||
|
"PlaybackError.NotAllowed": "",
|
||||||
|
"PlaybackError.RateLimitExceeded": "",
|
||||||
"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",
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
* Error types used for reporting media playback errors.
|
* Error types used for reporting media playback errors.
|
||||||
*/
|
*/
|
||||||
export enum MediaError {
|
export enum MediaError {
|
||||||
MEDIA_DECODE_ERROR = 'mediadecodeerror',
|
ASS_RENDER_ERROR = 'ASS_RENDER_ERROR',
|
||||||
MEDIA_NOT_SUPPORTED = 'medianotsupported',
|
FATAL_HLS_ERROR = 'FATAL_HLS_ERROR',
|
||||||
NETWORK_ERROR = 'network',
|
MEDIA_DECODE_ERROR = 'MEDIA_DECODE_ERROR',
|
||||||
SERVER_ERROR = 'servererror'
|
MEDIA_NOT_SUPPORTED = 'MEDIA_NOT_SUPPORTED',
|
||||||
|
NETWORK_ERROR = 'NETWORK_ERROR',
|
||||||
|
NO_MEDIA_ERROR = 'NO_MEDIA_ERROR',
|
||||||
|
PLAYER_ERROR = 'PLAYER_ERROR',
|
||||||
|
SERVER_ERROR = 'SERVER_ERROR'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue