ios-sdk icon indicating copy to clipboard operation
ios-sdk copied to clipboard

App disconnected after few seconds and appRemote(_ appRemote: didDisconnectWithError:) called.

Open vibhootitatva opened this issue 2 years ago • 5 comments

I checked "NowPlayingView" demo provided by spotify, it is playing music in spotify and also providing control in my app to play/pause etc.

but when i pause playback after few seconds Spotify is disconnecting and appRemote(_ appRemote: didDisconnectWithError:) calling. And I am receiving this error:

Error Domain=com.spotify.app-remote Code=-1002 "Connection terminated." UserInfo={NSLocalizedDescription=Connection terminated., NSUnderlyingError=0x282386dc0 {Error Domain=com.spotify.app-remote.transport Code=-2001 "End of stream." UserInfo={NSLocalizedRecoverySuggestion=Reconnect to the Spotify app., NSLocalizedDescription=End of stream., NSLocalizedFailureReason=One of the streams has reached the end.}}, NSLocalizedRecoverySuggestion=Try to reconnect., NSLocalizedFailureReason=The Spotify app might have been suspended.}

I see your reply on https://github.com/spotify/ios-sdk/issues/204, but my app is not suspended. as it is already open and running. Its not even in background. so there is an issue in spotify SDK, which is breaking connection between my app and spotify to remotely play.

To play music again, I have to authorise again to reconnect. obviously it is not good user experience and not even feasible flow.

Please help with solutions!

vibhootitatva avatar Jan 13 '23 04:01 vibhootitatva

Same here, I get this error often even though my app is running in the foreground, iOS idle timer is disabled, and Spotify music is playing continuously in the background.

Doing the authorizeAndPlayURI works to bring everything back, but its a very bad user experience.

nzoschke avatar Nov 18 '23 17:11 nzoschke

I have also been facing the same issue, I see the sockets get closed and we have to re-initialise the session. I have also observed that app remotes callbacks stop working after the sockets are closed and the player api callbacks are not responding anymore. 🚀🚀🚀

umair-irfan avatar Feb 04 '24 15:02 umair-irfan

same here

durgeshcodeapex avatar Mar 18 '24 06:03 durgeshcodeapex