1

For an upcoming project I am investigating the possibility to play only a certain length (for example 20s) of a track, using the Soundcloud API.

Could anybody indicate me if that is possible, or should a different track with that limited length be created separately?

Many thanks ! Maarten (WebForDreams)

1 Answers1

4

There are a few ways you can do this. Are you going to be using the JavaScript SDK or the player widget? For the player widget, you can just use seekTo().

If you're using the JavaScript SDK you can use the setPosition() method:

SC.initialize({
  client_id: 'foo'
});
SC.whenStreamingReady(function() {
  var sound = SC.stream(52933447);
  sound.setPosition(2000); // position, measured in milliseconds
  sound.play();
});

If you want to stop at a particular point, you could use onPosition().

Hope that helps!

Paul Osman
  • 4,119
  • 2
  • 26
  • 20
  • Hi Paul, better late than never, thank you very much for your answer. The project has just been kicked off, so will probably need a solution like the one you proposed. All the best and thanks again! – webfordreams Oct 06 '12 at 10:29