I'm building a webapp with Spotify and Deezer api where I can listen and control (next, previous, pause, play) music. Everything works well on Android devices or on desktop, but not with IOS devices (chrome / safari). I can control music from another spotify device: for example if I have Spotify app opened on my computer, I can start and switch tracks from the iphone, but the music never come from to it.
What I did is simple, after getting token, I check all the connected devices from a user, and active mobile if it exist. But iphone device is never recognized, I put a log and I can see there is no device if I try to play only from the iphone. After that, I just play the songs:
public playAlbum(track: Track, position?: number) {
const token = window.localStorage.getItem('wmg-as-token');
const body = {
'uris': [track.uri],
'offset': {
'position': 0
},
'position_ms': position ? position : 0
};
return this.http.put(`${this.uri}/me/player/play`, body, {headers: {'Authorization': 'Bearer ' + token}});
}
I'm not using Web Playback SDK, I'm using api endpoint : https://developer.spotify.com/documentation/web-api/reference/player/
I have lot of code that I can post (for exemple aout the transfer device), but I don't want to put too much code to not afraid readers. Maybe I just miss an information about ios.
If anyone has an idea I'm here..
EDIT :
I tried to launch website from IOS Simulator, and saw there are some error logs like this :
