瀏覽代碼

Fixed issue where song wouldn't stop playing after duration hits song duration.

KrisVos130 9 年之前
父節點
當前提交
b525e4daea
共有 1 個文件被更改,包括 4 次插入7 次删除
  1. 4 7
      app/client/client.js

+ 4 - 7
app/client/client.js

@@ -1101,7 +1101,7 @@ Template.stations.events({
                     height: 540,
                     width: 568,
                     videoId: id,
-                    playerVars: {autoplay: 1, controls: 0, iv_load_policy: 3, showinfo: 0},
+                    playerVars: {controls: 0, iv_load_policy: 3, showinfo: 0},
                     events: {
                         'onReady': function(event) {
                             event.target.seekTo(Number(song.skipDuration));
@@ -1754,20 +1754,17 @@ Template.room.onCreated(function () {
                 if (currentSong !== undefined) {
                     if (room !== undefined) {
                         var duration = (Date.now() - currentSong.started - room.timePaused) / 1000;
-                        var player_duration = undefined;
-                        if (yt_player !== undefined && yt_player.getDuration !== undefined) {
-                            player_duration = yt_player.getDuration();
-                            if (player_duration <= duration && yt_player.getState() === YT.PlayerState.PLAYING) {
+                        var song_duration = currentSong.duration;
+                            if (song_duration <= duration) {
                                 Session.set("pauseVideo", true);
                             }
-                        }
                         var d = moment.duration(duration, 'seconds');
                         if (Session.get("state") === "playing") {
                             $("#time-elapsed").text(d.minutes() + ":" + ("0" + d.seconds()).slice(-2));
                         }
                     }
                 }
-            }, 1000);
+            }, 100);
             resizeSeekerbarInterval = Meteor.setInterval(function () {
                 resizeSeekerbar();
             }, 500);