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

Inconsistant sound volume when player state changes #357

Closed
Betree opened this issue Mar 14, 2018 · 4 comments
Closed

Inconsistant sound volume when player state changes #357

Betree opened this issue Mar 14, 2018 · 4 comments

Comments

@Betree
Copy link

Betree commented Mar 14, 2018

I just updated from 0.25.3 to 1.2.1 and encountered this issue :

When seeking player position with a Youtube video either programmatically or manually by clicking on the progress bar (video controls must be activated) sound resets to its default value. It also happens when playing / pausing.

How to reproduce

  1. Take the default demo app and add controls to player's attributes
  2. Load Youtube Test A
  3. Change volume to a low value using player's controls
  4. Click on progress bar to seek a different position
  5. Volume changes

Preview

bugreactplayer 1

@Betree
Copy link
Author

Betree commented Mar 14, 2018

Problems comes from onPlay

https://github.com/CookPete/react-player/blob/d0334a2f55ce8258f38a7ac06a3b4799f8c2bb93/src/Player.js#L137

As ReactPlayer state is not updated when changing volume manually it will always go back to its default value when seeking or pausing / playing.

I don't know about other players but Youtube API doesn't seems to provide a onVolumeChange method. So the best solution for me is to set volume to null per default and only call setVolume in onPlay when it is set to a number value.

Would you accept a PR implementing this solution @cookpete ?

Betree added a commit to CaptainFact/captain-fact-frontend that referenced this issue Mar 15, 2018
@cookpete
Copy link
Owner

As of 1.3.0, the default volume is set to null and setVolume will not be called unless a non-null volume prop is passed in.

@Betree
Copy link
Author

Betree commented Mar 15, 2018

Thanks, that was fast !

@cookpete
Copy link
Owner

cookpete commented Mar 15, 2018

The only downside to this is that muted no longer works if volume is not set, as we do not know what the volume was before muting the player. Then again, I don't think muted is used by many.

david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue Dec 23, 2018
- Fixes cookpete/react-player#357
- Fixes `onStart` not firing when changing URLs
- Moves the forced `setVolume` to run on ready instead of every play event
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue May 23, 2020
- Fixes cookpete/react-player#357
- Fixes `onStart` not firing when changing URLs
- Moves the forced `setVolume` to run on ready instead of every play event
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
- Fixes cookpete/react-player#357
- Fixes `onStart` not firing when changing URLs
- Moves the forced `setVolume` to run on ready instead of every play event
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
- Fixes cookpete/react-player#357
- Fixes `onStart` not firing when changing URLs
- Moves the forced `setVolume` to run on ready instead of every play event
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
- Fixes cookpete/react-player#357
- Fixes `onStart` not firing when changing URLs
- Moves the forced `setVolume` to run on ready instead of every play event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants