"react-native-track-player": "1.2.0",
When changing the internet connection from WIFI to 4G (or vice-versa), the player looses connection and not resuming the stream anymore. I need to hard restart the app to restart the playing state.
Is there an event handler with example i can use to fix this or is there a way to prevent this?
Anyone? 鈽猴笍
Hey @maendamedia, You could use the plackback-error event to retry playing when an connection error occurs. Or maby something like @react-native-community/netinfo to know if you are connected to WiFi or 4G.
@maendamedia this is a normal iOS behavior. We solved this by storing the playing state (i.e. shouldBePlaying) separately.
When the state of the player changes to State.Stopped while shouldBePlaying is still true we force a TrackPlayer.play() and assume there was an unintentional interruption thus restarting the stream.
But I think it's technically impossible to handle this without interruption on online live streams as the TCP connection itself disconnects when the network interface changes.
@mhabegger how do you know if the player-changed event happened because a user hit stop, or something else?
Most helpful comment
@mhabegger how do you know if the player-changed event happened because a user hit stop, or something else?