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

Application Freeze when loading the video #577

Closed
janakact opened this issue Apr 19, 2017 · 25 comments
Closed

Application Freeze when loading the video #577

janakact opened this issue Apr 19, 2017 · 25 comments
Labels
stale Closed due to inactivity or lack or resources

Comments

@janakact
Copy link

If we are trying to play a video from a web URL, the whole application stay stuck (About 2-3 seconds until ) the a portion of the video is buffered. Seems like the whole UI rendering thread in blocked. Is there a solution for this or is it a bug?

@janakact
Copy link
Author

Tried different versions. Currently using,

    "react-native": "^0.38.0",
    "react-native-video": "github:react-native-community/react-native-video#9bcf70cbb513402622bc114f93da751c28f15303"

@dquak
Copy link

dquak commented Apr 24, 2017

Same here!
all UI is feezing for about 5-10 secounds before showing the video.
Tried @janakact solution with no luck:
"react-native": "0.42.3", "react-native-video": "github:react-native-community/react-native-video#9bcf70cbb513402622bc114f93da751c28f15303",

@kamalk333
Copy link

I faced the same Issue. Application freezes up because the video loading takes place on the main thread.
Try degrading the version of react-native-video to 0.9.0

It will work.

@dquak
Copy link

dquak commented Apr 25, 2017

@kamalk333 Thanks!! This fixed this issue, - BTW version 1.0.0 works as well for me.
When setting some mp4 file in the uri, it seem that the player is not buffering, but waiting for the video to fully loaded before start playing it, any idea of how to fix it?

@janakact
Copy link
Author

Solved. If you are using an older version,
try changing the following file. Change prepare(this); => prepareAsync(this);
https://github.com/ttdat89/demo-video-streaming/blob/master/node_modules/react-native-video/android/src/main/java/com/brentvatne/react/ReactVideoView.java#L301

Thanks Tien Dat for the help.

@dquak
Copy link

dquak commented Apr 27, 2017

@janakact Amazing, would really like to know how you got to this solution, as I would really like to fix the issue on the latest version

@mesbahsabur
Copy link

+1

@janakact
Copy link
Author

janakact commented May 4, 2017

@itay9001
Got it from [FB React Native Community group. You should contact Tien Dat
Hope it will be helpful.
https://www.facebook.com/groups/react.native.community/permalink/971188333016745/

@carbureted
Copy link

I'm having this issue on iOS (javascript FPS drops to 0 for a second or two when the video starts) - are there any fixes floating around for it?

@areeb111
Copy link

You would be better to use ExoPlayer because it's faster and more stable.
To use it follow these steps:
Go to node_modules/react-native-video/
Rename android to android-mediaplyer
Rename android-exoplayer to android
Run react-native run-android and Enjoy ExoPlayer :)

@PimDeWitte
Copy link

Some more info:

when buffering a currrent video, and then trying to create another video component and dispose of the current one, the new component will not start buffering until the previous video finishes buffeirng, causing the UI to lock.

@nartjie101
Copy link

+1 I got the issue in the latest code on IOS. It worked well on AD

@olivierlesnicki
Copy link

Same issue on iOS

@ami9000
Copy link

ami9000 commented Jul 6, 2018

Same issue on iOS. Application hang/freezes while a Video component buffers. Is there a fix for iOS?

@nartjie101
Copy link

nartjie101 commented Jul 6, 2018

@ami9000 you can follow #1086 post to temporarily fix the issue. Remove these props: 'ignoreSilentSwitch', 'rate', 'volume' and 'muted'

@ami9000
Copy link

ami9000 commented Jul 6, 2018

@nartjie101 Oh wow - this was the real issue! Thank you!

@anukuljha
Copy link

@itay9001 did you find any solution? stuck in a similar problem.

@hueniverse hueniverse added the stale Closed due to inactivity or lack or resources label Apr 22, 2022
@vaibhavgehani
Copy link

I still face this problem in iOS. Any one got the solution. Help

@freeboub
Copy link
Collaborator

@vaibhavgehani a fix has been pushed in last V6 release

@adriandiaz
Copy link

v6 release did not fix the issue for me in iOS

@Usman1214
Copy link

+1

1 similar comment
@douzal34
Copy link

+1

@vemarav
Copy link

vemarav commented Jul 11, 2023

@douzal34 @Usman1214 @adriandiaz @vaibhavgehani @ami9000
For ios:

modify applyModifiers with following changes:

add statements preceeded by + sign:

 
 
     func applyModifiers() {
+        if let video = _player?.currentItem,
+           video == nil || video.status != AVPlayerItem.Status.readyToPlay {
+            return
+        }
         if _muted {
             if !_controls {
                 _player?.volume = 0

@szpanel
Copy link

szpanel commented Jul 21, 2023

@vemarav Thank you, do you plan to post a PR of this?

@vemarav
Copy link

vemarav commented Jul 23, 2023

@vemarav Thank you, do you plan to post a PR of this?

@szpanel I have open PR #3173 for this but I don't have any rights to add label or assign reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Closed due to inactivity or lack or resources
Projects
None yet
Development

No branches or pull requests