react-player: [v2.10.1] `onProgress` callback is not firing when the video is playing
Be sure to search for your issue before opening a new one.
Current Behavior
onProgress
callback is not called when the video is playing.
Expected Behavior
onProgress
callback should be called periodically with the playback information when the video is playing.
Steps to Reproduce
-
Use version
v2.10.1
of react-player (issue does not exist inv2.10.0
-
Add a simple player as follows that plays a webm file
<ReactPlayer ref={playerRef} width={1024} height={768} muted playing={true} url="https://example.com/video.webm" onDuration={onDuration} onProgress={onProgress} />
-
The
onProgress
callback is never called
Environment
- URL attempting to play: Any url containing a video file (I used a webm file)
- Browser: Chrome
- Operating system: MacOS
Other Information
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 22 (4 by maintainers)
I can also confirm the issue with
"react-player": "2.10.1"
and React 18 usingreact-scripts
.I managed to temporarily fix it by removing
React.StrictMode
.Minimal reproduction: https://codesandbox.io/s/naughty-wildflower-pqvest
Expected behavior: it should log the
onProgress
eventsActual behavior: it does not log the
onProgress
eventsTemporary fix: remove
<StrictMode>
and now it does log theonProgress
events.Looking forward to the proper fix 🙂
When can we expect a release on the next version of react player
I’ve taken a moment to look into this and I think replacing (
src/Player.js
):with
should fix the issue.
I’ve created a PR with this fix. Please let me know if there are any issues with the proposed fix.
Thanks!
I have the same issue.
Fixed in
2.11.0
. Sorry for the delay.I created this a couple days a go to help illustrate the issue. Hopefully this helps.
@kgilliam125 turns out when I deploy the change to an environment,
onProgress
gets triggered:@manishsharma004 was alluding to this earlier, so the suggestion here is to disable strict mode (thanks @manishsharma004 !)