Closed tdammy92 closed 1 year ago
Please any one who can help on this ?
@tdammy92 I am facing same issue. Did you find any solution?
@mayur-shelar not yet , I might just remove the package completely. cause why would sound continue playing when user has left the screen. I want to belive there is somthing we might be missing out. but no body is even ready to help. 🤷🏽♂️
@tdammy92 I am able to stop the audio before the screen unmount. Simply add audio in the dependency array of useEffect were you are performing the operations which are to done before unmount. In our case it will like
useEffect(() => { const unsubscribe = navigation.addListener("beforeRemove", () => { audio?.stop(); audio?.release(); }); return unsubscribe; }, [navigation, audio]);
When the component mounts the state variable audio is empty. So what I found while debugging is when listener is triggered audio was undefined when audio was not passed in the dependency array.
@mayur-shelar Thank you very much bro, Your a life saver.
:beetle: Description Currently using this package for a chat app. before i un-mount the component. am calling the stop() method to stop the audio, but it keeps playing in the background.
To stop the audio currently playing when the user leaves the page.
:beetle: What have you tried? tried calling the stop() and even d pause(), not working.
:beetle: Please post your code:
:bulb: Possible solution
Is your issue with...
Are you using...
react-native run-android
)Which versions are you using?
Does the problem occur on...
If your problem is happening on a device, which device?