I am trying to set the position of a sample in SoundCloud using setPosition to play from a certain time when I call the play() method. I need to set this before the sample starts playing. Right now this code isn't working:
SC.whenStreamingReady(function() {
var sound = SC.stream("/tracks/141543551");
sound.play();
sound.setPosition(300);
});
However, when I call setPosition while the sample is playing it works just fine.
SC.whenStreamingReady(function() {
setTimeout(function () {
sound.pause();
var positionCallback = function (eventPosition) {
this.clearOnPosition(0, positionCallback);
this.resume();
};
sound.onPosition(0, positionCallback);
sound.setPosition(30000);
sound.play();
}, 5000);
});
How can I setPosition() before the sample plays?
The docs that I found here http://www.schillmania.com/projects/soundmanager2/doc/
Say that this sound.setPosition(300);
should look like sound.setPosition('position-name', 300);
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With