浏览代码

Added icon before current song in playlist, fixed YouTube song not playing bug.

KrisVos130 9 年之前
父节点
当前提交
10da5f0fd7
共有 2 个文件被更改,包括 10 次插入5 次删除
  1. 9 4
      app/app.js
  2. 1 1
      app/templates/playlist.html

+ 9 - 4
app/app.js

@@ -334,10 +334,6 @@ if (Meteor.isClient) {
     });
 
     Template.room.onRendered(function() {
-        $(window).resize(function() {
-            var player = document.getElementById("player");
-            player.style.height = (player.offsetWidth / 16 * 9) + "px";
-        });
         $(document).ready(function() {
             function makeSlider(){
                 var slider = $("#volume-slider").slider();
@@ -534,6 +530,14 @@ if (Meteor.isClient) {
         playlist_songs: function() {
             var data = Playlists.find({type: type}).fetch();
             if (data !== undefined && data.length > 0) {
+                data[0].songs.map(function(song) {
+                    if (song.title === Session.get("title")) {
+                        song.current = true;
+                    } else {
+                        song.current = false;
+                    }
+                    return song;
+                });
                 return data[0].songs;
             } else {
                 return [];
@@ -587,6 +591,7 @@ if (Meteor.isClient) {
                 var volume = localStorage.getItem("volume") || 20;
 
                 $("#media-container").empty();
+                yt_player = undefined;
                 if (currentSong.type === "SoundCloud") {
                     // Change id from visualizer to media-container
                     $("#player").attr("src", "");

+ 1 - 1
app/templates/playlist.html

@@ -3,7 +3,7 @@
   <ul id="playlist">
       {{#each playlist_songs}}
         <li>
-            <strong>{{title}}</strong> - {{artist}}
+            {{#if current}}<i class="fa fa-arrow-right" style="color: red;"></i>{{/if}} <strong>{{title}}</strong> - {{artist}}
         </li>
       {{/each}}
   </ul>