stop all videos when a new video is played in react native - react-native

i want to stop all video when new video is playing. I am using react-native-video library to play video. If I play a video it starts playing, if I click on another video in the list it also starts playing, both videos are getting played at the same time

Keep an array of video play/pause state to ensure that only one can be true at a time. Then update the Video component paused property on update.

Related

How to play 2 videos in react native and that can play/pause by one button?? I am using react-native-video

I want to play 2 videos with play pause by one button. both Video will pause on same time and will play on same time when we clicked on button.
I am using react-native-video.
Give ref to both videos, video1Ref and video2Ref, and on button press just start videos on both refs.
Both Video having different different ref and add these properties.
ref={playerRef1}
disableFocus={true}
useTextureView={false}
playInBackground={true}

Expo video plays in different time position on long press

I want to make this feature with React Native Expo-AV Video component.
When user long press on video component, video will play 1 second at 4 different time positions like in xvideos' videos.Or do they use gif in video's poster?

In react-native-video, how do I reset the video player when the video has finished playing?

I have a react-native app with videos that I am displaying using react-native-video. Right now when the video has finished playing you have to manually drag the control for the position of the video back to zero and then press play to have the video restart.
How can I make the video automatically reset when it has been played to the end? (Or even better, is there any way to add a replay button?)
Currently the app is only for iOS.
Try adding repeat value equals to true in Video Component. It will do your work and video will autoplay upon ending.
<Video...repeat={true}/>

How to Get the Playable duration in react native video when the video is paused

I am using the react-native https://github.com/react-native-community/react-native-video library to play the videos in my mobile app.
Now I wanted to show the playable duration ( amount of video that is already loaded in the player) as you can see in the picture
To get the playable duration i am using the following method
onProgress={this.onProgress.bind(this)}
Problem here is that this method only triggers when the video is playing ,this method is not called when the video is paused
so my question is is there any way i can get the playable duration when the video is paused

play sound of youtube video when app is in background

I am using RMYouTubeExtractor to play youtube video inside my app in a MPMoviePlayerController.
I need to play the sound of the video (and show the thumbnail of the video on the lock screen) if the phone is locked or the app is in the background.
Is there any way to do that ?
Please help.
Thank you.