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

Not working in conjunction with useEffect #814

Open
jordangrant opened this issue Jan 8, 2023 · 4 comments
Open

Not working in conjunction with useEffect #814

jordangrant opened this issue Jan 8, 2023 · 4 comments
Labels

Comments

@jordangrant
Copy link

jordangrant commented Jan 8, 2023

Appreciate the work done here but ran into many issues playing sound effects while listening with useEffect ala:

 useEffect(() => {
       playSound(battle?.animation)
    }, [battle?.animation]);

and with .aac files crashing #802

and with the error "playback failed due to audio decoding errors"

tried useRef to no avail #728 (comment)

and different syntax, moved things around, you get the idea. tested on iOS device.

Had quicker and easier success with react-native-video: https://github.com/react-native-video/react-native-video

Thanks for the good times though

@tdammy92
Copy link

hi @jordangrant I think our issues are similar am trying to stop the current song when the user is leaving the screen.

which am doing inside a useEffect. but it not working.

did you find a solution around yours ?

@jordangrant
Copy link
Author

@tdammy92 no solution with this library, simply using react-native-video with invisible views, and mp3, mp4 and m4a files works absolutely perfectly and great settings to control it too.

@tdammy92
Copy link

@jordangrant, Add the audio as part of the dependency. it should work

useEffect(() => {
playSound(battle?.animation)
}, [battle?.animation,audio]);

@BraveEvidence
Copy link

This will help https://www.youtube.com/watch?v=vVI7ZAZq5e0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants