TheWidlarzGroup / react-native-video

A <Video /> component for react-native
http://thewidlarzgroup.github.io/react-native-video/
MIT License
7.16k stars 2.88k forks source link

Two instances don't work together. After start only one plays #2666

Closed nkschmidt closed 2 years ago

nkschmidt commented 2 years ago

Bug

I'm not sure if this is a bug, but I have a problem with this. In my case, I need to play video (hls) and background music from a remote host. I am trying to use two instances. The first is for video playback and the second is for background music. I have a common state (pause and mute state) and I pass it to different components. When I click the play button, only one component works.

Can I use two instances to play different sources in sync?

Which player are you experiencing the problem on:

Library version: 5.2.0

Steps To Reproduce

  1. Just add two instance with different sources
  2. Start playing sync

Expected behaviour

  1. Music and video must play together
freeboub commented 2 years ago

Such feature is not implemented and would be hard to implement on react-native-video side. This should be supported by exoplayer first, and then integrated in RNV... Generally these problematic are handled on server side (need timestamp on stream for live for exemple or use RTSP for synchronizaed playback)...

nkschmidt commented 2 years ago

Such feature is not implemented and would be hard to implement on react-native-video side. This should be supported by exoplayer first, and then integrated in RNV... Generally these problematic are handled on server side (need timestamp on stream for live for exemple or use RTSP for synchronizaed playback)...

maybe I didn’t write quite right, I don’t need to run two different sources synchronously. If they diverge for a few seconds, this is normal for my case. In general, I cannot start playing two different sources at the same time

freeboub commented 2 years ago

Ok, sorry I didn't undertand... So it should work :) I work a forked repo (with a lot of changes) and I was able to make working on this branch. To be checked. I have a sample I can push in a near future

hueniverse commented 2 years ago

We use two video components overlayed in our app and are able to keep them both playing and in sync without a problem. The sync sometimes is off by up to a second because of slow seek performance when the viewer fast forwards but otherwise it works fine.

If you are able to reproduce the issue by forking https://github.com/react-native-video/react-native-video-test we can look further. Closing for now.

nkschmidt commented 2 years ago

We use two video components overlayed in our app and are able to keep them both playing and in sync without a problem. The sync sometimes is off by up to a second because of slow seek performance when the viewer fast forwards but otherwise it works fine.

If you are able to reproduce the issue by forking https://github.com/react-native-video/react-native-video-test we can look further. Closing for now.

I reproduced this bug, you can check it: https://github.com/NikSmith/react-native-video-test I can't play two sources if I use exoplayer.

mishabelokon commented 2 years ago

We have fixed it on our side by setting disableFocus={true} prop to all the video components. Not sure if it's the correct fix, but it works for us

freeboub commented 2 years ago

A note has recently been added in doc: https://github.com/react-native-video/react-native-video/pull/2849 I close this ticket, let me know if you need to reopen it

AnshIcode commented 5 months ago

@mishabelokon Thanks its worked for the android , in ios its by default working, thanks for the solutiion