-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Several Video instance in memory not working on Android #2984
Comments
@douzal34 faces similar problem As there is so many videos within the flatlist multiple videos plays simultaneously and most of the time the app stuck and Andorid not responding message showing ..what to do for that ? please help .... |
I just allowing video component to be active for three videos in the flat List, the current index, the top and the bottom. |
I want to active the video component active for the current index of the flatlist after (as flatlist contain images and videos) that when imgae component coming it will deactive the video component or video instance , only video instance active when current index is a video file ....but please help how to deactive/active video instance Please help sir @douzal34 |
I think we might've faced a similar issue ( We have a FlatList with multiple relatively small videos (512x512 or less) running simultaneously (up to 50) and looped. Videos are fetched from a remote source. Works perfectly fine on iOS, however after some time the app gets frozen on Android. Specifically, android 13. We've tested this on multiple devices, on android 11, 12 and 13. We've noticed that after 1-4 minutes (depending on the phone and the amount of videos running) the whole app becomes unresponsive. For android 12 and lower - fine and dandy. We ran a profiler and haven't noticed a memory leak there (memory increases, but gc was doing it's job), but worth double checking. But (gonna repeat myself) this issue happens for us specifically on android 13. Please correct me if this is unrelated. Would love to see a response from the maintainers, thank you in advance! P.S. we've noticed an unrelated thing as well: if the video is looped, by the end of every iteration the video would get refetched. P.P.S we haven't tried another package (e.g. React Native: 0.69.2 |
UPD: after trying to reproduce this on a clean project, I can say that the issue I described above is not related to No lags or freezes on a completely new project ran on android 13. Tested both on [email protected] and 0.71.1. So it seems that there might be some package that conflicts or leaks specifically on android 13, however it doesn't seem to be @douzal34 highly recommend testing on a fresh project. Since videos are quite memory-consuming part of RN, highly suggest checking other packages that are used directly or indirectly. (like |
Might be related, started noticing similar logs in Android Studio: #2767 |
FYI, after many more days of debugging, my issue it turned out to be linked to this: facebook/react-native#34583. Specific to Android 13 and inverted Flatlist. |
Hi @fsher ! First, thanks for your effort in order to find a solution. I am not using inverted on FlatList and i doubt the issue come from this. I saw #2723 and i'm not surprised about theirs issues. For my case largeHeap and hardwareAccelerated was already setup, it help on some cases but not for all cases. I mean, i have some users who have a very light Android phone like 130-150 euros and when there's some issues memory they are first to have issues cause they don't have a lot of memory available to handle these cases. For my pro phone 300 euros, issue appear rarely, unmount / mount some video component with screenIsFocused hook is the trick in order to let users see videos. the bad way of this is you can't preload many videos, so in some cases they have to wait in order to see videos. I hope we will find a solution ! |
Greetings, I stumbled upon this ticket (coming from ticket #2723) as I have the same problems on Android (
I followed a recommendation (#2767 (comment)) to limit the buffer to solve a known exoplayer problem described here. So I set {
minBufferMs: 2500,
maxBufferMs: 5000, // default is 50 000, 50 seconds
bufferForPlaybackMs: 2500,
bufferForPlaybackAfterRebufferMs: 2500,
} The videos I use as an example are not longer than a minute as such I do not want to buffer 50 seconds on repeat. My import { useIsFocused } from '@react-navigation/native';
import Video from 'react-native-video';
import convertToProxyURL from 'react-native-video-cache';
// [omitted]
<Video
repeat
disableFocus
useTextureView={false}
paused={!isVisible || !isFocused}
muted={isFocused ? isMuted : true}
source={{ uri: convertToProxyURL(media.uri) }} // Can be a URL or a local file.
style={styles.video}
resizeMode={'cover'}
bufferConfig={{
minBufferMs: 2500,
maxBufferMs: 5000,
bufferForPlaybackMs: 2500,
bufferForPlaybackAfterRebufferMs: 2500,
}}
/> This has stopped the application from crashing. Edit: I still get blank screens instead of videos when I push too many pages on the Navigation stack (
Edit 2: Setting source to As written in the docummentation for
So I used a work around like so: <Video
// ...
source={isFocused ? { uri: convertToProxyURL(media.uri) } : null}
// ...
/> So now every time a screen gets out of focus, the source is set to Edit3: Setting |
please tell me how can I solved this android has not play video my package.json and this is my <Video
also set setting.gradle set android player how can I solved it please help me android not play smoothly and also show invalid url when set url is blank |
@wolfxpertlab you should stop the video, not only pause it. |
@freeboub please explain with example , help me I am very stuck how can I solved it play video smoothly in android and which solution use for other method stop video or decoder |
As I know, if u change source to null it will stop not just pause |
Thank You @vargajacint when change to 0 to null that show error invalid url |
Any idea for azure server service for play video in smoothly play in android and solved it how can I encode and hls method for play video smoothly any information please tell me encode or HLS , insort how can I implement and play smoothly |
Can you try following patch: #3416 |
I have a FlatList w/ Videos and I was able to workaround this Memory issue by disabling
Not the best fix since I need this feature, but seems to work 🤷 |
To be retested on beta.6 |
Bug
Happy new year to all !
I am the creator of SoSkills app which is available on Apple and Android
SoSkills is a video sharing community application in the gaming ecosystem.
More info here https://soskills.io
Keep in mind user can swipe through videos on the Home page with FlatList as Instagram short, TikTok etc
If user want to see these videos on his profile, he changed screen without umounting Home page and he goes on Profile page.
Then he clicks on these videos and he starts see videos. At this point, i will generate a new FlatList in memory with Video component player too.
When this case happen, react-native-video will not work on new Video component cause too many instances of Video is already up.
This bug occur exclusively on Android not on Apple.
So the trick is to hide Video component from Home page in order to allocate memory and instance to Video component on Profile page, otherwise Video component is not loading the video and user is stuck.
It's a shame to do that, cause it's impact user experience.
Platform
Environment info
React native info output:
React native: 0.67.3
React native-video version: [v6.0.0-alpha.4]
Steps To Reproduce
Create a FlatList with videos, go on other page and let the Home page still active, start a new FlatList with Video component, video will not load the video, user will be stuck
Expected behaviour
I want to be able to have some Video component already mounted on paused and to have some active Video component on other screen
Reproducible sample code
SoSkills is a private company, code is not open source so can't do that but i shared screenshot and video
Video sample
The text was updated successfully, but these errors were encountered: