react-native-spotify-remote icon indicating copy to clipboard operation
react-native-spotify-remote copied to clipboard

Error: Connection attempt failed. Ensure the Spotify app is installed, and try to reconnect. Stream error. Reconnect the transport to the Spotify app. The operation couldn’t be completed. Connection refused

Open dhavalpkakadiya opened this issue 3 years ago • 17 comments

Hello @cjam

I am facing an issue when using Spotify remote on the iOS app, I’ve been trying to debug this issue for the past couple of days but didn't get any appropriate solution.

Spotify authorization succeeds and then connection to Spotify fails with this error: Connection attempt failed, Ensure the Spotify app is installed, and try to reconnect. Stream error. Reconnect the transport to the Spotify app. The operation couldn’t be completed. Connection refused.

IMG_0067

Thanks, @cjam for this library!

React-Native Version: 0.64.0 
react-native-spotify-remote: 0.3.9

dhavalpkakadiya avatar Sep 16 '21 10:09 dhavalpkakadiya

Have you tried closing spotify and re-authenticating?

cjam avatar Sep 20 '21 19:09 cjam

Hi, i'm facing the same issue. The authentication succeed, so if i try to close Spotify app and try again, it will not call to authenticate again and just call connect function

khoitruongg avatar Sep 21 '21 10:09 khoitruongg

Have you tried closing Spotify and re-authenticating?

@cjam yes, I have check this flow multiple times and getting the same issue.

dhavalpkakadiya avatar Sep 22 '21 05:09 dhavalpkakadiya

Hello, I am facing the similar issue. Authentication succeed, I tried to close spotify app and authenticate and also opened spotify and then authenticate both didn't work.

Couldn't authorize with or connect to Spotify Error: Spotify connection failed: could not find the Spotify app, it may need to be installed.

MudulOzan avatar Oct 26 '21 18:10 MudulOzan

Hello, I am facing the similar issue. Authentication succeed, I tried to close spotify app and authenticate and also opened spotify and then authenticate both didn't work.

Couldn't authorize with or connect to Spotify Error: Spotify connection failed: could not find the Spotify app, it may need to be installed.

It requires Spotify app is playing when you connect, you should set a default song url when set up before trying to connect

khoitruongg avatar Oct 26 '21 18:10 khoitruongg

@MudulOzan did you ever figure this out?

cjam avatar Nov 11 '21 14:11 cjam

@MudulOzan did you ever figure this out?

Kinda gave up :P focused on my react js projects had many problems with react native

MudulOzan avatar Nov 11 '21 15:11 MudulOzan

Fair enough. Some of these issues are challenging to sort out. I wish I could get a little more support from Spotify with some of them.

cjam avatar Nov 22 '21 04:11 cjam

Fair enough. Some of these issues are challenging to sort out. I wish I could get a little more support from Spotify with some of them.

Thanks for your help. I will update this issue if I get rid of my real life issues and decide to come back at this. Thanks for your efforts, I really appreciate it.

MudulOzan avatar Nov 22 '21 11:11 MudulOzan

Facing this issue as well.

For me after a while when a song is paused, the remote automatically disconnects (it might be the expected behaviour?) But the problem is after if I try to connect to the remote again I get that exact error message. So the user is forced to re-authenticate again and my app opens Spotify again, which is very annoying in terms of user experience.

Aren't we supposed to be able to connect again with a still valid auth session?

Thanks,

mickaeloak avatar Dec 16 '21 22:12 mickaeloak

Currently experiencing this issue as well. The token should still be valid as SpotifyAuth.getSession() shows that the token is not expired, however, trying to (re)connect using that same token, I just get the same error as everyone else here.

Has anyone been able to solve this issue in the meantime?

Thanks

gijsfonk avatar Mar 08 '22 14:03 gijsfonk

For me after a while when a song is paused, the remote automatically disconnects (it might be the expected behaviour?) But the problem is after if I try to connect to the remote again I get that exact error message. So the user is forced to re-authenticate again and my app opens Spotify again, which is very annoying in terms of user experience.

How do you re-authenticate again? It looks like the session is stored and considered “valid” by react-native-spotify-remote but cannot be used with the app since it has been put to the background by iOS. So I would need to recreate the session, but I cannot find a way to do it...

ghost avatar May 19 '22 13:05 ghost

@cjam I am facing the same issue. Do you have any update regarding this? IMG_1382 Here is my error!!

Kindly help me to fix out this issue.

vishalsiddhi avatar Nov 07 '22 17:11 vishalsiddhi

@cjam @mickaeloak @MudulOzan @khoitruongg Can anyone help me to resolve above error? I had tried my best but still not able to resolve this issue.

vishaltanna avatar Nov 13 '22 13:11 vishaltanna

@vishaltanna I found no solution to this

MudulOzan avatar Nov 14 '22 15:11 MudulOzan

Hey, sorry for the lack of feedback from me. I'm swamped with work so this gets pushed down the priority.

For those of you who are having an issue with this, can you please include the following information:

Required Information

Platform:
Emulated?: Os Version: React Native Version: Package Version:

Without this, it's hard to get to the bottom of the issue.

iOS Backgrounding / Disconnection

For those who are talking about the backgrounding on iOS, it's a known issue / limitation of the Spotify Remote SDK. I've mentioned it to their developer advocates, but alas, it still exists. It's because iOS will aggressively background applications that aren't using certain functionality (i.e. when you pause the music, spotify is no longer using the audio stream). Therefore, we have to hack around it, a few options:

  • Play silence (there are many silent tracks on spotify)
  • reconnect the library when you are about to resume playback

cjam avatar Nov 14 '22 16:11 cjam

@cjam

Platform: iOS Emulated: iPhone SE (Real Device) Os Version: 16.1 React Native Version:0.60.0 Package Version:0.3.10

Here is detail which you asked me to check it out further.

It will be great if you help me to sort it out this issue.

vishaltanna avatar Nov 16 '22 19:11 vishaltanna