javascriptplaybackdeezer

Deezer API - get current position


I want to track when a user starts playing a song. My Problem is that it is only possible to track the play Button (in my opinion). But I only want the beginning of the song and not every Play Button click (also when the user has pause the song and resume it).

Therefore I wanna check the current position of the song and track only when the current position is below 1 second or something. Does anyone know how to get the position of the current playing song? The only thing regarding the player position I have found was the player_position event which is triggered when the position within the song has changed.

Any ideas? The very last I want to do is to store a variable that remembers, if the song was already tracked or something.


Solution

  • The only way to know when an user has started to play a song is to use the "player_position" as you said. It is different than the "player_play" which is executed when you use the "DZ.player.play" action. If you want, you have an example here http://developers.deezer.com/sdk/javascript/example-invisible which displays how it works.