Player & duration fix 1
This commit is contained in:
parent
4d2c32ec8e
commit
42f3e6e5ca
|
@ -14,6 +14,7 @@ class TrackController < ApplicationController
|
|||
#render :inline => nginx_url
|
||||
headers['Content-Type'] = 'audio/mpeg'
|
||||
headers['X-Accel-Redirect'] = nginx_url
|
||||
headers['Connection'] = 'close'
|
||||
render :nothing => true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
<li id="<%= track.id %>">
|
||||
<span class="play<%= (track.inDb ? '' : ' disabled') %>"><img src="/images/player/play.svg" alt="play" /></span>
|
||||
<span class="track-name"><%= track.name %></span>
|
||||
<span class="duration" data-length="<%= track.length %>"><%= track.length.toTime %></span>
|
||||
<% unless track.length.nil? %>
|
||||
<span class="duration" data-length="<%= track.length %>"><%= track.length.toTime %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<div id="contents">
|
||||
<div class="inner-1">
|
||||
<div id="player">
|
||||
<audio></audio>
|
||||
<audio autoplay preload></audio>
|
||||
<div class="prev"><img src="/images/player/prev.svg" alt="prev" /></div>
|
||||
<div class="play"><img src="/images/player/play.svg" alt="play" /></div>
|
||||
<div class="pause" style="display:none"><img src="/images/player/pause.svg" alt="pause" /></div>
|
||||
|
|
|
@ -30,9 +30,9 @@ location ~* ^/proxy-stream/(.*?)/(.*?)/(.*?)/(.*?)/(.*) {
|
|||
# backend does not support Content-Disposition
|
||||
# headers used to specify file name browsers use
|
||||
# when save content to the disk
|
||||
proxy_hide_header Content-Type;
|
||||
proxy_hide_header Content-Disposition;
|
||||
add_header Content-Disposition 'attachment; filename=audio.mp3';
|
||||
proxy_ignore_headers Cache-Control;
|
||||
#add_header Content-Disposition 'attachment; filename=audio.mp3';
|
||||
#add_header Connection 'close';
|
||||
|
||||
# Do not touch local disks when proxying
|
||||
# content to clients
|
||||
|
|
|
@ -52,7 +52,7 @@ function formatTime(sec) {
|
|||
return m +':'+ (s < 10 ? '0' : '') +s;
|
||||
}
|
||||
function playTrack(artist, track, id) {
|
||||
$(audio).attr('src', '/listen/'+ id +'/');
|
||||
$(audio).attr('src', '/listen/'+ id +'.mp3');
|
||||
$('#player .track-title').html(artist +' — '+ track);
|
||||
$('#player .time-played').html('0:00');
|
||||
$('#player .time-left').html('0:00');
|
||||
|
@ -79,4 +79,4 @@ function addToPlaylist(artist, track, length, id) {
|
|||
if ($('#playlist ul li').length == 1) {
|
||||
playTrack(artist, track, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue