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

addPlayBackListener flood #273

Closed
sayem314 opened this issue Apr 10, 2021 · 2 comments · Fixed by #286
Closed

addPlayBackListener flood #273

sayem314 opened this issue Apr 10, 2021 · 2 comments · Fixed by #286
Labels
1️⃣ good first issue Good for newcomers
Milestone

Comments

@sayem314
Copy link

Version of react-native-audio-recorder-player

2.6.2

Platforms you faced the error (IOS or Android or both?)

Tested only on Android

Expected behavior

Should not flood and should only execute when playing

Actual behavior

The player event is fired too much in a row, it even also gets fired when the player is paused. The event should throttle and only fire when it's playing.

Steps to reproduce the behavior

  useEffect(() => {
    Player.addPlayBackListener((e: any) => {
      console.log(e);
    });

    return Player.removePlayBackListener;
  }, []);
@sayem314
Copy link
Author

sayem314 commented Apr 10, 2021

Okay so setting Player.setSubscriptionDuration(1); does throttle subscription but there should be better defaults like 500ms or 1sec. However, it's still a valid issue since the subscription is fired even when in the player is in a pause state.

@hyochan hyochan added the 1️⃣ good first issue Good for newcomers label May 4, 2021
@hyochan
Copy link
Owner

hyochan commented May 8, 2021

Closes in #286 with 3.0.0-beta.2 release!

@hyochan hyochan closed this as completed May 8, 2021
@hyochan hyochan added this to the 3.0.0 milestone May 8, 2021
@hyochan hyochan linked a pull request May 8, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1️⃣ good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants