浏览代码

Fixed issue #3

KrisVos130 9 年之前
父节点
当前提交
78e617f340
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      app/app.js

+ 5 - 0
app/app.js

@@ -1,6 +1,7 @@
 History = new Mongo.Collection("history");
 History = new Mongo.Collection("history");
 
 
 if (Meteor.isClient) {  
 if (Meteor.isClient) {  
+    var hpSound = undefined;
     Template.register.events({
     Template.register.events({
         "submit form": function(e){
         "submit form": function(e){
             e.preventDefault();
             e.preventDefault();
@@ -63,6 +64,9 @@ if (Meteor.isClient) {
         "click .logout": function(e){
         "click .logout": function(e){
             e.preventDefault();
             e.preventDefault();
             Meteor.logout();
             Meteor.logout();
+            if (hpSound !== undefined) {
+                hpSound.stop();
+            }
         },
         },
 
 
         "click .button-tunein": function(){
         "click .button-tunein": function(){
@@ -76,6 +80,7 @@ if (Meteor.isClient) {
         "click #play": function(){
         "click #play": function(){
             $("#play").hide();
             $("#play").hide();
             SC.stream("/tracks/172055891/", function(sound){
             SC.stream("/tracks/172055891/", function(sound){
+                hpSound = sound;
                 sound._player._volume = 0.3;
                 sound._player._volume = 0.3;
                 sound.play();
                 sound.play();
                 $("#stop").on("click", function(){
                 $("#stop").on("click", function(){