react-sound
react-sound copied to clipboard
Decrease update interval
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

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