Open garrett-a opened 2 years ago
I believe I might be having a similar issue and I have found that it's due to changing the state whilst updating the video url.
See a codesandbox example here: https://codesandbox.io/s/distracted-resonance-kc0ylj?file=/src/App.tsx
All I am doing is:
playing
prop.playing
to false
url
prop.Countdown
again to play the video, the video does not play but the playing
prop is true.Update: I noticed that if you set the url
to null
the playing
prop is respected again 🤔
I've faced the same issue and I don't know how to fix it. The playing
attribute is not working until I manually click on video to change current position.
OMG I found a solution for my case! I added this:
<ReactPlayer
....
onPlay={() => {this.setState({playing: true})}}
....
/>
It looks like when user starts the video, my variable this.state.playing
is unsynced with actual video's attribtute. Keeping it up to date helps... Damn JS...
I was having the same issue, what you need to do is -
wherever you are setting the value of playing
state as false
first change the same playing set to true
and then immediately on the next line set it to false
again.
It will work. Thanks
Current Behavior
Playing prop not changing when setting state. Initial state is set to true. All streams are mapped as user searches.
Expected Behavior
I'm trying to play/pause all twitch streams on button click. In the console I can see my initial state as true on load. When clicked the state goes to false but nothing is happening.
Environment