unknown 9 роки тому
батько
коміт
c36ad35a92
1 змінених файлів з 8 додано та 2 видалено
  1. 8 2
      app/app.js

+ 8 - 2
app/app.js

@@ -216,12 +216,18 @@ if (Meteor.isClient) {
                 if (currentSong.song.type === "soundcloud") {
                   $("#player").attr("src", "")
                   getSongInfo(currentSong.song.title);
-                  SC.stream("/tracks/" + currentSong.song.id + "/", function(sound){
+                  SC.stream("/tracks/" + currentSong.song.id + "#t=20s", function(sound){
+                    console.log(sound);
                     _sound = sound;
                     sound._player._volume = 0.3;
-                    console.log(sound);
                     sound.play();
                     console.log(getTimeElapsed());
+                    var interval = setInterval(function() {
+                        if (sound.getState() === "playing") {
+                            sound.seek(getTimeElapsed());
+                            window.clearInterval(interval);
+                        }
+                    }, 200);
                     // Session.set("title", currentSong.song.title || "Title");
                     // Session.set("artist", currentSong.song.artist || "Artist");
                     Session.set("duration", currentSong.song.duration);