Spotify Play Button - autoplay? - spotify

I am trying to integrate Spotify Play Button into ThingLink Spotify tag so that when the iframe loads, it starts playing automatically. Is there a way to do that with some parameter?
The functionality would be similar to Soundcloud & Vimeo players here:
http://www.thinglink.com/scene/251225958915244034
Without the autoplay, user would have to click on Play twice, which wouldn't be that good of UX.
Thanks!
-Albert

There is no autoplay functionality at present.
Autoplay isn't really what the Play Button is about — it's designed so people can listen to music if they want to. We don't really want to interrupt whatever the user is listening to already (be it something in Spotify, something else, or silence) without express permission to do so first.

Related

Is it possible to control the spotify desktop client from a browser with custom controls?

I am a developer for playmoss where users can create playlists with different music services.
We are planning on adding Spotify support to our playlists in a way similar to what bop.fm does.
Context
Taking for example this playlist (in which all songs are available on spotify, at least in Spain)…
https://bop.fm/p/o12l
…if we have the spotify client installed in our computer (tested with a Mac)
As soon as the playlist starts playing we can click the spotify icon on the top right [picture]and we will be playing the songs through spotify.
Using the bop.fm control interface we can pause, play, skip next, even skip to a point in the track with progress bar.
This is similar but even more powerful than the official spotify play button, see an example here:
http://jsfiddle.net/insonorizate/a5jf39yn/
With the play button there is previous, play, pause, next functionality but not seek.
Of course it can not be customized in any way nor called from javascript.
(in bop.fm is possible to open a debuger console and call
Bop.Player.pause()
or
Bop.Player.play()
to pause or play the track beeing played in bop.fm via spotify)
Fiddling a little with the bop.fm page there are some interesting things. Ther is an iframe in the main page poiting to:
https://embed.spotify.com/remote-control-bridge/
Viewing this iframe source we find something like this:
// Expose the OAuth Token to the Javascript
var tokenData = 'NAowChgKB1Nwb3RpZnkSABoGmAEByAEBJReQCFQSFG2Ynvz1oBKgxv2mE1XXz_1Au-cg';
// Pass the remote control to the bridge
var remoteControlBridge = new Spotify.RemoteControlBridge();
remoteControlBridge.init(tokenData);
There's no documentation for Spotify.RemoteControlBridge (0 results for "Spotify.RemoteControlBridge" on google) and there isn't any thing in the documentation of the different apis even close to controling the spotify player in a way similar to this.
Question
How can I control the spotify desktop app from a browser?
Does bop.fm have any special arrangment with spotify and they are using some "secret api"?
Are they exploiting some functionality that I fail to find?
Is it possible to replicate it?
Is it in accordance with the Spotify terms?
Thanks!
You can't control the Spotify Client or Listen to Events the Spotify Web Helper is emitting. Imagine everybody could: every website could potentially play a song without your permission or even know instantly what you are listening to. To prevent this Spotify only allows approved partners to use this feature.
As you figured out the remote-control-bridge provides this functionality. It can communicate with the Spotify Web Helper running on your system, which is secured by an OAuth and a CSRF Token. In the remote-control-bridge you even can see the allowed partners:
Spotify (who knew)
Yahoo
last.fm
coachella.com
bop.fm
sandpit.us
echonest
musixmatch
You can contact them and ask for a partnership. I'm sure they won't bite.
This is actually a little bit documentated on the website of Spotify in the developers section.
I think bop.fm does use their custom Spotify Play Button widget. That makes use of the iframe that you mentioned.
Here you can find the documentation about this functionality of Spotify. You can then modify it to your own needs using Javascript etc.

Showing a YouTube video in a Google Chrome extension

I would like to embed a YouTube player onto a page and show it to a user. If a foreground popup is used to host the player then, when the popup loses focus, the player is destroyed because the entire popup is removed.
I was hoping to use webKitNotifications.createHTMLNotification() and embed a player inside of an HTML Notification, but the spec has since been deprecated.
Just curious if anyone has any really crafty ideas on how to achieve this? I suspect hosting the YouTube player on a background page is a violation of YouTube's Terms of Service.
Looking through the dev. channel APIs:
http://developer.chrome.com/extensions/notifications.html - Too restrictive compared to HTML Notification. Doesn't look like I can embed a YouTube player inside one of these guys.
and... that's really about it.
Advice appreciated. Thanks.
You can simply have an HTML file in your extension for your page, for instance video.html, list it in your manifest under web_accesible_resources, and show it using:
chrome.tabs.create({url: chrome.extension.getURL('video.html')});
Inside your page you can use whatever method you want to embed the YouTube player.

Embed YouTube videos in thirdparty player

Is there any website video player that I can embed YouTube videos in that also displays a playlist?
I want to be able to see the playlist and as far as I know the YouYube provided player that allows for playlists doesn't show the list unless you click on the playlist button in the top left. I want something with a playlist under or beside the video window that shows at all times.
youtube uses an iframe (as simple as that) to deliver content. Any website can display youtube playlists if the url in the "embed code" has the variables to do that. I forget the url but I am sure it is possible. I hope I got your question right...

Spotify vs Last FM, display last played track

I was looking for a way to display my last played Spotify track on my website. I succeeded using the Last.FM API. Spotify doesn't have an open API and the music part of Facebook seems to be locked down too. So I now scrobble everything to last.fm and use their API to get the last played song. This works fine, but I thought it would be fun to display a "play now" button to play the track on spotify.
To do that, I need the Spotify ID for the particular song, which the last.fm api doesn't seem to return.
So... two questions:
1) is there a way to get the same info from Spotify itself?
2) if not, is there a good way to get the matching spotify song using the Last.FM details?
1) No. Spotify doesn't have a play history API. However, you can use Facebook's listens endpoint if the user is publishing listens to Facebook.
2) Not directly, as far as I'm aware. However, a quick Google turns up this project. Failing that, you can use the Spotify Web Search API to search for a track matching the metadata. The Advanced Search Syntax may come in handy here.

Prevent song playing on URI link click

I'm working on a Spotify app where I'd like for users to be able to click on track names and be linked to the track page, just like in other Spotify apps. I'd like to prevent the song from beginning playback, though.
SoundDrop seems to do this. You can click on a track name and the song doesn't interrupt playback by SoundDrop.
I'm not sure how to implement this alternative behavior. Any ideas?
The Apps API uses standard JavaScript stuff, so if you attach a handler to the track link and use e.preventDefault(), that should prevent Spotify playing the track and you can then do your own custom handling.
More discussion on e.preventDefault() is here: event.preventDefault() vs. return false

Resources