Skip to content
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

[BUG]: Poster not working on android #3640

Closed
LunatiqueCoder opened this issue Apr 2, 2024 · 9 comments · Fixed by #3643
Closed

[BUG]: Poster not working on android #3640

LunatiqueCoder opened this issue Apr 2, 2024 · 9 comments · Fixed by #3643
Assignees
Labels

Comments

@LunatiqueCoder
Copy link

LunatiqueCoder commented Apr 2, 2024

Version

v6 (Beta)

What platforms are you having the problem on?

Android

Architecture

Old architecture

What happened?

When using the poster prop, it works for a few seconds at the beginning, and then we have a blank screen.

Reproduction

N/A

Reproduction

N/A

Solution:

diff --git a/node_modules/react-native-video/src/Video.tsx b/node_modules/react-native-video/src/Video.tsx
index e496efc..5a97630 100644
--- a/node_modules/react-native-video/src/Video.tsx
+++ b/node_modules/react-native-video/src/Video.tsx
@@ -376,7 +376,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
     );
 
     const _onReadyForDisplay = useCallback(() => {
-      setShowPoster(false);
+      setShowPoster(!!poster);
       onReadyForDisplay?.();
     }, [setShowPoster, onReadyForDisplay]);
@freeboub freeboub self-assigned this Apr 2, 2024
@freeboub
Copy link
Collaborator

freeboub commented Apr 2, 2024

Thank you for the patch, I will clarify the expected behavior soon. (But if you want to have a poster instead of the video, you should do it on the app side)

@freeboub
Copy link
Collaborator

freeboub commented Apr 2, 2024

I open a PR to fix the issue. I think you should be able to test it !
changing source without remount didn't reset the setShowPoster value

@LunatiqueCoder
Copy link
Author

Hey @freeboub this seems to be reproducing on the latest version as well (v6.4.3) 😢

@freeboub freeboub reopened this Jul 25, 2024
@LunatiqueCoder
Copy link
Author

LunatiqueCoder commented Jul 25, 2024

@freeboub This is how I managed to fix it:

diff --git a/node_modules/react-native-video/src/Video.tsx b/node_modules/react-native-video/src/Video.tsx
index 49ca1e9..5cc196c 100644
--- a/node_modules/react-native-video/src/Video.tsx
+++ b/node_modules/react-native-video/src/Video.tsx
@@ -452,7 +452,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
     );
 
     const _onReadyForDisplay = useCallback(() => {
-      hasPoster && setShowPoster(false);
+      setShowPoster(hasPoster);
       onReadyForDisplay?.();
     }, [setShowPoster, hasPoster, onReadyForDisplay]);

Let me know if you want me to open a PR with this, it would be my pleasure to contribute.

@moskalakamil
Copy link
Member

Hi @LunatiqueCoder, I see that this issue is still active. We would be grateful for your PR!

@Gautham495
Copy link

@moskalakamil Please solve this for android. @LunatiqueCoder It worked for android thank you!

@LunatiqueCoder
Copy link
Author

I’m happy it worked for you. I’ll create a PR on Monday

@Gautham495
Copy link

@LunatiqueCoder Sorry it did not work properly for videos which has posters. I made a custom solution to tackle this issue.

@freeboub
Copy link
Collaborator

I tested again on the last version, I don't reproduce the issue.
Let's close this old ticket, please reopen a new one if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants