ToneDen / Player

A pure JS customizable audio player for SoundCloud.
toneden.io/player
MIT License
529 stars 77 forks source link

To know when the song is finished #15

Closed sebgord closed 10 years ago

sebgord commented 10 years ago

Can you add a Listener to know when the song is finished please ? I want to use this to make an action after.

Thank you for your great player :)

Merci

tim-thimmaiah commented 10 years ago

Hey @sebgord. You can now pass in a callback function to be executed after a track has finished playing. Same with when a playlist has finished playing. These are set when the player is first initialized.

Here's an example:

ToneDen.player.create({
    dom: '#single-player-demo',
    urls: [
        'https://soundcloud.com/saintpepsi/unhappy'
    ],
    onTrackReady: function() { alert("That was awesome!");}
});
tim-thimmaiah commented 10 years ago

Closed in 29a8448d698e932288b7546aebe31068f7063030

sebgord commented 10 years ago

Hi Tim,

first thanks for your answer. It's very appreciate :) I tried to use "onTrackFinished" and "onPlaylistFinished" (found into your doc) and unfortunately it doesn't work (the song seems to not finish, it stops at 1s from the end...).

Thanks for your help,