I am working on a react-native app and need to update the URL. It is now hooked with useEffect() but the player is stopped after an update of the state.
Usually calling player.load() inside of useEffect() works as long as all the used variables/parameters are part of the useEffect’s dependencies array.
If you update the URL and a new load of player.load() happens, the player is meant to be stopped, as any call to player.load() means resetting internal state of the player and load the given source.
One source of an unwanted call might happen in case channelData changes but the url property doesn’t.
In this case you have to separate state, at least locally, by capturing channelData.url and channelData.name outside of the useEffect in local variables and use them for the useEffect’s dependencies.