mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
12 lines
386 B
TypeScript
12 lines
386 B
TypeScript
![]() |
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;
|
||
|
}
|