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