Decrease update interval

Open
#99 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript

Research direction

Start at the Sound component's sound creation entry point, where html5PollingInterval and the onPlaying callback are configured. Check how the updateInterval prop is passed to soundmanager2 and how onPlaying timing is determined. Done means a documented, working interval control that produces the requested callback frequency.

Written by the indexing model from the issue text.

Description

Hi leoasis, I've been trying to find a way to control the interval to which onPlaying is called but couldn't find any in docs or source code.
So I tried understanding the code and build it myself but couldn't figure it out.

What I did was I added a new property called "updateInterval" and gave it to html5PollingInterval (the property I think is relevant to this usecase in soundmanager2).
This is a spinet of my change (at line 183) in your code:

177   this.stopCreatingSound = _createSound({
178           url: this.props.url,
179           autoLoad: this.props.autoLoad,
180           volume: this.props.volume,
181           position: this.props.playFromPosition || this.props.position || 0,
182           playbackRate: this.props.playbackRate,
183           html5PollingInterval: this.props.updateInterval,
184           whileloading: function whileloading() {
185             instance.props.onLoading(this);
186           },

And then in my code I added updateInterval and set it to 50:

<Sound
    url={audioUrl}
    playStatus={playStatus}
    onPlaying={(player) => {handleOnPlaying(player);}}
    position={audioPos}
    onFinishedPlaying={handleFinishedPlaying}
    updateInterval={50}
/>

But the result show an interval of about 200 to 300

image

This is crucial to my use case and would love to have your feedback.
Thank you in advance

Dominant language
JavaScript
Stars
490
Forks
80
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from leoasis/react-sound

All issues in leoasis/react-sound

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.