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

Problem with react-sound with setInterval #85

Open
nkhanh90 opened this issue Aug 21, 2019 · 0 comments
Open

Problem with react-sound with setInterval #85

nkhanh90 opened this issue Aug 21, 2019 · 0 comments

Comments

@nkhanh90
Copy link

nkhanh90 commented Aug 21, 2019

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

@nkhanh90 nkhanh90 changed the title Problem with interval Problem with react-sound with setInterval Aug 21, 2019
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