Play/pause Spotify desktop from web browser - javascript

I try to find the solution used in bop.fm to control Spotify desktop application.
I guess somehow uses some iframe "https://embed.spotify.com/remote-control-bridge/"
Any idea?
thank you very much

Related

Spotify API does only get a few devices but my phone gets them all

I am making a spotify controller using their API https://developer.spotify.com/console/get-users-available-devices/ but when I only receive a response with 3 devices, but on my phone when I click "connect to a device" I get every device in my house (8). Is there another API you can use that gets all the devices? Something I've noticed is that if I start playing music on the devices that are not shown they will pop up, very weird
Unfortunately the web API does not support certain devices, including third-party speakers. Moreover, I've noticed that devices are sometimes not available if the app is not open, or your phone screen is locked, or the device isn't actively playing music. After playing music they will only stay available for a few minutes.
While those devices may be accessible via the Spotify app, they aren't through the API. This is super frustrating, and makes using the Player API very difficult, but unfortunately it's been this way for a long time and it doesn't look like Spotify intends to fix it any time soon.
See this issue: https://github.com/spotify/web-api/issues/671
And device list doc: https://developer.spotify.com/documentation/web-api/guides/using-connect-web-api/#devices-not-appearing-on-device-list
Related spotify community post: https://community.spotify.com/t5/Spotify-for-Developers/v1-me-player-devices-returns-empty-array/m-p/5224904
Note: If you are trying to connect to Sonos devices, they are restricted via the Spotify API but may be accessible via the Sonos API

How to play spotify full tracks in browser

I want to use the spotify api to build a simple audio player embedded into a chrome extension. I've integrated the auth flow and I'm able to get a token to use for the api requests. I'm looking at the documentation to find a way to play the user playlists or searched tracks but I'm not able to find any useful information. They have only this SDK but a premium account is needed.
Is possible to use the spotify uri to play a full track or playlist after authentication?
No, there's currently no way to play the full song using the Web API. If you want full tracks to be playable from a website, you can use the Spotify Play Button. If you want to build a mobile application, you can do playback of full tracks using the Android and/or iOS SDK.
I'm doing it right now using the Spotify Web API and this:
https://github.com/JMPerez/spotify-web-api-js
I'm running this locally to provide refresh tokens:
https://github.com/spotify/web-api-auth-examples
I'm still figuring it out, but I definitely have things playing in my browser on local.

Reading output audio data from Spotify Web Playback stream

I am currently playing around with audio visualization and I am trying to work with Spotify's Web Playback SDK to stream and analyze songs directly on my site.
However, I am unsure what the limitations are when it comes to actually reading the streamed data. I've noticed that an iframe is generated for the Spotify player, and I've read that spotify uses the encrypted media extensions to stream the audio on chrome.
Is it even possible to read the music data from the Spotify api? Maybe, I can read the output audio from the browser?
According to the web API documentation, you aren't able to play back full songs and get the audio data like you desire (for obvious reasons). Although, 30 second "song previews" are allowed through URL streaming, as well as full song playback on desktop browsers (excluding safari at the time of this post), with the Web Playback SDK.
However on the mobile API it is now possible to get the raw PCM data (Android or iOS). This will require you registering for a developers account and setting up the access tokens if you haven't already done so.
For quick reference, on Android it involves using the AudioController class.
EDIT : Thanks to #Leme for the Web Playback SDK link.

Is it possible to use the web audio api with deezer javascript sdk?

I am currently building a small app where music visualization happens. Currently I have to embed my mp3's or have to search for them on soundcloud.
The spotify API does not allow you to access the song in a web app and everything happens via the widget.
Is Deezer (and all other music streaming services for that matter) in the same boat? I can't quite figure out from the javascript SDK page if it is possible or not.
You're right, it is not possible to retrieve the MP3s directly, you have to use the Javascript SDK that does not allow to have a music visualization unfortunately.

Spotify Desktop app : content slider doesn't show in app but it shows in Web browser

I'm developing on Spotify Web App on the desktop.
I'm trying to add Image/contentSlider (Which is use javascript/css and jquery) in WebApp.
I tested on Web browser like google Chrome and Safari. It works fine.
but in Spotify App. It doesn't work. It feels like javascript disabled.
Do I need to add something about spotify api to make working fine?

Categories