diff --git a/src/components/htmlMediaHelper.js b/src/components/htmlMediaHelper.js
index 09eb2a6095..fa1b343caa 100644
--- a/src/components/htmlMediaHelper.js
+++ b/src/components/htmlMediaHelper.js
@@ -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
return Promise.resolve();
}
- return Promise.reject();
+ return Promise.reject(e);
})
.then(() => {
onSuccessfulPlay(elem, onErrorFn);
diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js
index cfdfcbdb52..7b2d96d078 100644
--- a/src/components/playback/playbackmanager.js
+++ b/src/components/playback/playbackmanager.js
@@ -20,6 +20,7 @@ import { getItems } from '../../utils/jellyfin-apiclient/getItems.ts';
import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdropImage';
import { MediaError } from 'types/mediaError';
+import { getMediaError } from 'utils/mediaError';
const UNLIMITED_ITEMS = -1;
@@ -1781,7 +1782,7 @@ class PlaybackManager {
playerData.isChangingStream = false;
onPlaybackError.call(player, e, {
- type: MediaError.PLAYER_ERROR,
+ type: getMediaError(e),
streamInfo: streamInfo
});
});
@@ -2564,7 +2565,7 @@ class PlaybackManager {
onPlaybackStarted(player, playOptions, streamInfo, mediaSource);
setTimeout(function () {
onPlaybackError.call(player, err, {
- type: MediaError.PLAYER_ERROR,
+ type: getMediaError(err),
streamInfo
});
}, 100);
@@ -3232,7 +3233,7 @@ class PlaybackManager {
const errorType = error.type;
- console.warn('[playbackmanager] onPlaybackError:', error);
+ console.warn('[playbackmanager] onPlaybackError:', e, error);
const streamInfo = error.streamInfo || getPlayerData(player).streamInfo;
diff --git a/src/strings/en-us.json b/src/strings/en-us.json
index e0318abe6d..01237cb45d 100644
--- a/src/strings/en-us.json
+++ b/src/strings/en-us.json
@@ -1228,16 +1228,16 @@
"Play": "Play",
"PlayAllFromHere": "Play all from here",
"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": "",
+ "PlaybackError.ASS_RENDER_ERROR": "An error was encountered in the ASS/SSA subtitle renderer.",
+ "PlaybackError.FATAL_HLS_ERROR": "A fatal error was encountered in the HLS stream.",
+ "PlaybackError.MEDIA_DECODE_ERROR": "Playback failed due to an error decoding the media.",
+ "PlaybackError.MEDIA_NOT_SUPPORTED": "Playback failed because the media is not supported by this client.",
+ "PlaybackError.NETWORK_ERROR": "Playback failed due to a network error.",
+ "PlaybackError.NO_MEDIA_ERROR": "Unable to find a valid media source to play.",
+ "PlaybackError.PLAYER_ERROR": "Playback failed due to a fatal player error.",
+ "PlaybackError.SERVER_ERROR": "Playback failed due to a server error.",
+ "PlaybackError.NotAllowed": "Playback of this media is not allowed.",
+ "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.",
"PlaybackErrorPlaceHolder": "This is a placeholder for physical media that Jellyfin cannot play. Please insert the disc to play.",
"PlaybackRate": "Playback Speed",
diff --git a/src/utils/mediaError.ts b/src/utils/mediaError.ts
new file mode 100644
index 0000000000..14b6c91eea
--- /dev/null
+++ b/src/utils/mediaError.ts
@@ -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;
+}