Use onMediaUnsupported on android too

This commit is contained in:
Zoe Roux 2024-02-01 00:51:18 +01:00
parent 8c910fa532
commit 6265f9bc2c
2 changed files with 7 additions and 2 deletions

View File

@ -32,7 +32,7 @@ export type Snackbar = {
key?: string;
label: string;
duration: number;
actions: Action[];
actions?: Action[];
};
export type Action = {

View File

@ -64,7 +64,7 @@ const videoAtom = atom(0);
const clientId = uuid.v4() as string;
const Video = forwardRef<VideoRef, VideoProps>(function Video(
{ onLoad, onBuffer, source, subtitles, ...props },
{ onLoad, onBuffer, onError, onMediaUnsupported, source, subtitles, ...props },
ref,
) {
const { css } = useYoshiki();
@ -98,6 +98,11 @@ const Video = forwardRef<VideoRef, VideoProps>(function Video(
onLoad?.(info);
}}
onBuffer={onBuffer}
onError={(e) => {
// 24001 is codec error
if (e.error.errorCode === "24001") onMediaUnsupported?.();
else onError?.(e);
}}
selectedVideoTrack={
video === -1
? { type: SelectedVideoTrackType.AUDO }