JoshLmao / Spotify4Unity

🎮🎵 Add the SpotifyAPI.NET library into Unity, enabling access to the Spotify Web API, allowing for control of Spotify and accessing the world of music
https://assetstore.unity.com/packages/tools/integration/spotify4unity-ui-tools-spotify-authorization-129028
MIT License
94 stars 8 forks source link

SpotifyServiceBase.IsPlaying always returns false #10

Closed timendez closed 3 years ago

timendez commented 5 years ago

Hi, I'm trying to detect when Spotify is playing, and at first glance this was just what I needed. However, it always seems to be returning false. Doesn't this need to be a function with a network request in order to get the proper state (e.g. if Spotify is playing on a different machine)?

Perhaps I just don't understand this enough, but by no means is this a dealbreaker, so don't worry if there's no functionality for it!

JoshLmao commented 5 years ago

Hmm, that IS a strange one. Can you try logging the output every frame and see if it's still false? Then, try changing the song to another one and see if it's still saying false?

timendez commented 5 years ago

Yep still false every frame. Tried changing/playing/pausing via the Spotify4Unity API and also the Spotify app on my phone, and also the Spotify app on my computer. The Unity app was running on my phone. I'm stumped!

JoshLmao commented 5 years ago

Okay, I think it must have been fixed in between your version and v1.4 (I'm on that now, developing). I thought it could be a Free vs Premium account thing but I tested it and it works 🤔

I took the Android scene and added some text that shows the state and it's showing correctly. (Excuse the broken Android screen)

I'm actually finished with v1.4 and adding iOS support so I'll finish up the documentation as fast as possible and get it out for you. By the way, which version are you using right now?

timendez commented 5 years ago

I'm on v1.3.1, also using a Premium account.

No rush on getting it out, this is a very low priority item for my application 😄

JoshLmao commented 5 years ago

v1.4 just got updated on the Asset store. Could you try updating and letting me know if you're still getting the same error?

FYI: "Android Spotify Service" has changed to "Mobile Spotify Service" so you will have to readd that script after updating

timendez commented 5 years ago

Unfortunately it's still false after the update

JoshLmao commented 5 years ago

Wow, okay. So a couple questions and things...

Apart from those, I'm struggling to see what could be causing it. Unless SpotifyServiceBase.UpdateInternal() method is throwing exceptions like "Aborted SpotifyService internal update - {threadException}" or "SpotifyService internal Update loop exception - '{exception}'" and you're not seeing them?

I know you say it's a low priority but if something's now working properly, I should get it fixed ASAP so I'm a little concerned 😬