Answer the question
In order to leave comments, you need to log in
How to track that the SoundCloud player has downloaded?
Here is the SoundCloud API
There are
several SoundCloud players on the page and of course loading them with the page is stupid.
Therefore, it was decided to load the player when opening the tab in which it is located.
But in order to avoid jumps, you must first track if the player has loaded and then open the tab.
And now I've been trying for an hour through experiment to figure out how to track this moment, but I can't find anything in the API and through experiment.
Can anyone come across and can tell?
Answer the question
In order to leave comments, you need to log in
Here is an example.
(function () {
var widgetIframe = document.getElementById('sc-widget');
var widget = SC.Widget(widgetIframe);
widget.bind(SC.Widget.Events.READY, function () {
alert('Виджет плеера загрузился!');
widget.bind(SC.Widget.Events.PLAY, function () {
alert('Начато воспроизведение');
// get information about currently playing sound
widget.getCurrentSound(function (currentSound) {
console.log('sound ' + currentSound.get('') + 'began to play');
});
});
});
}());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question