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

Decrease update interval #99

Open
ajakka opened this issue Aug 4, 2021 · 0 comments
Open

Decrease update interval #99

ajakka opened this issue Aug 4, 2021 · 0 comments

Comments

@ajakka
Copy link

ajakka commented Aug 4, 2021

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

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

1 participant