فهرست منبع

play/stop added

unknown 9 سال پیش
والد
کامیت
f951512b10
3فایلهای تغییر یافته به همراه32 افزوده شده و 8 حذف شده
  1. 5 0
      app/app.css
  2. 5 8
      app/app.html
  3. 22 0
      app/app.js

+ 5 - 0
app/app.css

@@ -338,3 +338,8 @@ footer a:hover{
   display: block;
   margin: 0 auto;
 }
+#dashboard .station .controls{
+  font-size: 2em;
+  display: block;
+  text-align: center;
+}

+ 5 - 8
app/app.html

@@ -5,17 +5,12 @@
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
   <link href='http://fonts.googleapis.com/css?family=Oxygen:400,300,700' rel='stylesheet' type='text/css'>
   <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
-  <script src="https://connect.soundcloud.com/sdk.js"></script>
+  <script src="https://connect.soundcloud.com/sdk-2.0.0.js"></script>
   <script>
     function init() {
-      /*SC.initialize({
+      SC.initialize({
           client_id: "577d3fbbdb5fe05bb4af698d686508fe"
       });
-
-      var sound = [];
-      SC.stream("/tracks/293", function(sound){
-          sound.play();
-      });*/
     }
   </script>
 </head>
@@ -90,7 +85,9 @@
             <p class="song-title">Immortals</p>
             <p class="song-artist">Fall Out Boy</p>
           </div>
-          <button class="button-tunein">Tune in to station!</button>
+          <!-- <button class="button-tunein">Tune in to station!</button> -->
+          <i id="play" class="fa fa-play controls"></i>
+          <i id="stop" class="fa fa-stop controls" style="display:none"></i>
         </div>
       </div>
     </div>

+ 22 - 0
app/app.js

@@ -61,6 +61,28 @@ if (Meteor.isClient) {
     "click .logout": function(e){
         e.preventDefault();
         Meteor.logout();
+    },
+
+    "click .button-tunein": function(){
+      SC.stream("/tracks/172055891/", function(sound){
+        console.log(sound);
+        sound._player._volume = 0.3;
+        sound.play();
+      });
+    },
+
+    "click #play": function(){
+      $("#play").hide();
+      SC.stream("/tracks/172055891/", function(sound){
+        sound._player._volume = 0.3;
+        sound.play();
+        $("#stop").on("click", function(){
+          $("#stop").hide();
+          $("#play").show();
+          sound._player.pause();
+        })
+      });
+      $("#stop").show();
     }
   })
 }