mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
adjust web playback error handler (#1150)
This commit is contained in:
@@ -233,17 +233,17 @@ export const AudioPlayer = forwardRef<AudioPlayerRef, AudioPlayerProps>((props,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { error } = target;
|
const { error } = target;
|
||||||
if (error?.code !== MediaError.MEDIA_ERR_DECODE) {
|
|
||||||
|
console.log('Playback error occurred:', error);
|
||||||
|
|
||||||
|
if (
|
||||||
|
error?.code !== MediaError.MEDIA_ERR_DECODE &&
|
||||||
|
error?.code !== MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const duration = player.getDuration();
|
|
||||||
const currentTime = player.getCurrentTime();
|
|
||||||
|
|
||||||
// Decode error within last second, handle as track ended
|
|
||||||
if (duration && duration - currentTime < 1) {
|
|
||||||
handleOnEnded();
|
handleOnEnded();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user