Problem with react-sound with setInterval
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 490
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
I have setInterval and Sound play same time in useEffect()
const [road, setRoad] = useReducer((state = {top: 0, left: -265, right: 0, bottom: 0, opacity: 1}, action) => {
const newState = {...state}
if (action.type === 'moving' && action.param) {
if (state.left >= action.param) {
newState.left -= 10
}
else {
setStop(true)
}
}
return newState
});
const [play, setPlay] = useState('PAUSED')
useEffect(() => {
setRoad({type: 'moving})
setPlay('PLAYING')
}, [])
sound0: waiting
soundmanager2.js:1307 sound0: Buffer state change: 1
soundmanager2.js:1307 sound0: setPosition(0)
soundmanager2.js:1307 sound0: playing ♫
soundmanager2.js:1307 sound0: Buffer state change: 0
soundmanager2.js:1307 sound0: waiting
soundmanager2.js:1307 sound0: Buffer state change: 1
soundmanager2.js:1307 sound0: playing ♫
soundmanager2.js:1307 sound0: Buffer state change: 0
soundmanager2.js:1307 sound0: setPosition(0)
soundmanager2.js:1307 sound0: waiting
soundmanager2.js:1307 sound0: Buffer state change: 1
soundmanager2.js:1307 sound0: setPosition(0)
soundmanager2.js:1307 sound0: playing ♫
soundmanager2.js:1307 sound0: Buffer state change: 0
soundmanager2.js:1307 sound0: waiting
soundmanager2.js:1307 sound0: Buffer state change: 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported interaction between setInterval, useEffect(), and the Sound component, using the provided reducer and soundmanager2.js logs as the entry points. Determine the intended playback behavior and confirm that the repeated waiting, buffering, and playing messages no longer occur unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100