Reputation: 113
I want to trigger an action once the play button is pressed; or more accurately when the play button is pressed and the moment music begins to play. Is this possible to do?
From my understanding you cannot do this through the Spotify API. Would there be any other services that could do this?
Upvotes: 1
Views: 320
Reputation: 1548
It seems that with the api it can actually be done.
If you check the example here: http://lab.possan.se/thirtify you will see that everytime you click on the start button the event "PlayerController: player changed." is logged into the console.
If you check the code for this example app here https://github.com/possan/webapi-player-example/blob/master/controllers/player.js you will see on line 109 that you have a function executed for that event :
$rootScope.$on('playerchanged', function() {
I guess from here you can find a way to do whatever you need (it's not 100% clear what you want) but still i think it's possible to achieve whatever action you want to be executed on play.
Upvotes: 1