Marcus Hansson
Marcus Hansson

Reputation: 145

Detect commercial in Spotify App API

Is there any way to detect if a commercial is playing? I'm using

player.observe(models.EVENT.CHANGE, function (event)

to detect when a new song is played. The problem is that this event occurs when a commercial is played too.

(Hard to test if you have a developer account tied to the premium service without commercials.)

Upvotes: 1

Views: 458

Answers (1)

StevenR
StevenR

Reputation: 396

The Track class appears to have a hidden property called isAd, which can be accessed like track.data.isAd, which presumably would contain the data you want (you can see this property and others by using console.log(track) in your app.

As this property is undocumented, I'm not sure whether it is acceptable to use this it in a published app. Somebody from Spotify would need to answer that one.

Upvotes: 2

Related Questions