所以我正在使用 SoundCloud api 流式传输声音,我想知道如何在流中设置当前时间并获取流中的当前时间。如果后者不可能,那也没关系,因为我可以将 setInterval 用作秒表之类的东西。所以如果我使用这个:
SC.stream('/tracks/' + track.id, function(sound){
sound.start();
}
我愿意
sound.--method to get current time in sound--();
和
sound.--method to set current time in sound--();
最佳答案
实现这一目标的一种方法可能是这样的:
SC.stream("/tracks/" + track.id, {
autoPlay: true,
whileplaying: function () {
console.log(this.position);
}
});
http://jsfiddle.net/iambnz/wmm7agq5/
此处设置方法:
http://www.schillmania.com/projects/soundmanager2/doc/#soundmanager-setposition
关于javascript - SoundCloud API- 获取当前时间并在流式传输时设置当前时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26621409/