阅读背景:

Soundcloud API / SoundManager2 SetPosition在track播放之前不工作

来源:互联网 

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:

在调用play()方法时,我试图使用setPosition设置SoundCloud中的样本的位置,从某个时间开始。我需要在开始播放示例之前设置这个。现在这个代码不起作用:

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.

然而,当我调用setPosition时,当样本在播放时,它就会正常工作。

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?

如何在示例播放之前设置()?

1 个解决方案

#1


1  

The docs that I found here https://www.schillmania.com/projects/soundmanager2/doc/

我在这里找到的文档https://www.schillmania.com/projects/soundmanager2/doc/

Say that this sound.setPosition(300); should look like sound.setPosition('position-name', 300); instead.

说这sound.setPosition(300);应该是什么样的声音。setPosition(position-name,300);代替。


分享到: