Skip to content

fix: error message overlaps video player when re connect #60893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8 changes: 8 additions & 0 deletions src/components/VideoPlayer/BaseVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ function BaseVideoPlayer({
videoPlayerRef.current?.setStatusAsync?.({rate: currentPlaybackSpeed});
}}
onLoad={() => {
if (hasError) {
setHasError(false);
}
if (!isCurrentlyURLSet || isUploading) {
return;
}
Expand All @@ -502,6 +505,11 @@ function BaseVideoPlayer({
onPlaybackStatusUpdate={handlePlaybackStatusUpdate}
onFullscreenUpdate={handleFullscreenUpdate}
onError={() => {
// No need to set hasError while offline, since the offline indicator is already shown.
// Once the user reconnects, if the video is unsupported, the error will be triggered again.
if (isOffline) {
return;
}
setHasError(true);
}}
testID={CONST.VIDEO_PLAYER_TEST_ID}
Expand Down