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

Error: player command failed no active device found #46

Open mseiringer opened 2 years ago

mseiringer commented 2 years ago

Hi everyone! We are getting this error and don't know how to solve it. "player command failed no active device found" We are grateful for all your tips. THANKS!

267industries commented 2 years ago

Hi everyone, We are getting the same error. Could some help us out please? Thank you in advance.

appsbymansa commented 1 year ago

Same problem here... Have you found a solution?

Jwho303 commented 1 year ago

I found that you can gather the devices before playing. It's a hack but just to get over to the next step. you gather the devices and then pass them into the request


               DeviceResponse devices = await client.Player.GetAvailableDevices();
                string s = $" Devices: {devices.Devices.Count}";
                for (int i = 0; i < devices.Devices.Count; i++)
                {
                    s += $"\n{devices.Devices[i].Name}";

                }
                Debug.Log(s);

                // Play track in context of the playlist
                PlayerResumePlaybackRequest request = new PlayerResumePlaybackRequest()
                {
                    ContextUri = _contextUri,
                    OffsetParam = new PlayerResumePlaybackRequest.Offset() { Uri = _track.Uri },
                    DeviceId = devices.Devices[0].Id
                };
                await client.Player.ResumePlayback(request);