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

react native Video with flatList (with multiple video) on Scrolling App not responding and crashed the app #3058

Closed
iasreact1 opened this issue Mar 9, 2023 · 13 comments

Comments

@iasreact1
Copy link

I am using react-native-video-5.2.1, don't know whether use android exo-Player or mediaPlayer. There are so many videos in the flatlist and when get Scrolled it get stuck the UI and app not responding error, Please help what to do for solving it, but if i use the video plaer to another page for playing the video then it working fine but when playing the video within the Flatlist ANR is coming every time & every Device, Please help ...to overcome it..

@LucasHimelfarb
Copy link

Your UI was blocked because Your UI is likely freezing because the listing is not optimized, either because you are displaying many heavy elements or because there is a design anti-pattern in your code causing multiple renders depending on state variables that are being updated. But without a code sample, it's difficult to know for sure.

@iasreact1
Copy link
Author

@LucasHimelfarb i have an api call 10 data per page and there is multiple state variable for video play/pause, mute/unmute etc loading opacity, and if i use a log that will print 10 times for the first rendering ...how can i improve the performance?

@krunalinfynno
Copy link

i am getting same issue as well.

@LucasHimelfarb
Copy link

@iasreact1 @krunalinfynno Im sorry for the late answer. The Flatlist`ve many props to improve perfomance, for example the props "removeClippedSubviews" and "getItemLayout". You can see all props here: https://reactnative.dev/docs/flatlist

If anyone have some issue please share some code to detect common problems

@trubnikovr
Copy link

@LucasHimelfarb
I'm using a modal with a FlatList inside it as a horizontal slider. I've noticed that if I slide and the video is still playing, then the app crashes.

@freeboub
Copy link
Collaborator

freeboub commented Apr 2, 2024

If someone can provide a sample app, it would be very useful to reproduce (and fix) the issue!

@EuSet
Copy link

EuSet commented May 25, 2024

here is a stack trace if it can be helpful. version 6.1.1
trace

@freeboub
Copy link
Collaborator

@KrzysztofMoch can you please have a quick look to this callstack ?

@freeboub
Copy link
Collaborator

regarding to the initial issue, I created a flat list sample here: https://github.com/freeboub/react-native-video-flatlist-sample
It seems to work fine

@KrzysztofMoch
Copy link
Member

KrzysztofMoch commented Jun 10, 2024

@KrzysztofMoch can you please have a quick look to this callstack ?

Seems like crash is caused by setting some metadata properties (probably image)

@freeboub
Copy link
Collaborator

@EuSet It would need to be tracked in a dedicated ticket

@KrzysztofMoch On this line, asset is nil ?

let metadata = currentItem.asset.commonMetadata + currentItem.externalMetadata

@KrzysztofMoch
Copy link
Member

@freeboub no it would crash differently - it will be lower, probably in place when we are setting NowPlayingInfo data eg artwork

@freeboub
Copy link
Collaborator

@EuSet can you please open a new ticket, I close this one.

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

No branches or pull requests

7 participants