From fde077e72eeb97218ece92d771cb31ebcf5a5e91 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Fri, 21 Feb 2014 20:12:50 -0500 Subject: [PATCH 1/2] correct pause button --- .../images/content/icon_pausebutton.png | Bin 1266 -> 1159 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/web/app/assets/images/content/icon_pausebutton.png b/web/app/assets/images/content/icon_pausebutton.png index 0df0af051d13704f98cecba04b065d973da4f8a0..3dcd6420f170a76fd8be7a12f709d882d7d8f823 100644 GIT binary patch delta 532 zcmeyw+0Loh8Q|y6%O%Cdz`(%k>ERLtq(wlOgAGXbcFOWjRMcQpp6J!5YO0%TU}UIZ zZmDNzYGP?oWCbP-1!pre69YpF6H8-b zGebjHV@FeGb0;%PBSRw~ZD8s;IfF?CrpOehq9sfQnl7$p=7welmX=1AZrDsxQYbD7 zN=>s$nOw*utN>N*h)eZk17@fC*n1nQfgb$j>Eaktacj#|L#}2A0oT%8pTxOJOBL=N zP}?ZFW>3SD5XSXM(!rJOUp#Xsnr!;XyxBl1Q0O{8f60yi7YoZuw_ZEfVk6KblJell zSGFq;xZW-JUljD9Ln5RqQgprSkEgxdMTr>)C0h=pJFVNA6npO8dI#Za%|a}~_5S%B z6~6jT?2Q{aywjSFsVJG4HO_kxsVOENqb-)T^uo`Sd<%7O&7czDXos{ZgW9-$%2q?`ki1 zC|#(?ex1DeWJ2`)s@XDpvt{DL_#&=<)0cRle1IWe!98xWiINsD92h)Z{an^LB{Ts5 DsIRo| delta 677 zcmZqY{KTo)8Q|y6%O%Cdz`(%k>ERLtq=iA4gAGU)1(=fH~v**WC}K$EYGA7V`ygRWNc|@Z0zLZ zVrb}UWZ~rO=HhH-Xl`lhVr*hyprlZdTj1+!<&vLVnwy$e;^|_m1QgLr$xN|=>NUZo zck*H;1DFMdxD+WV6qf|0rdg%nw!jFN-pTsRPW9W4eV@p{z?kCc;uunKYt0l}zrzj! zt#6N77%9{#acRvm(Fn3~ai6Rt>XKQ@bcE4@N8Cf!b)jdchbxzhUZa3VfXhLZq)O)V z7dPE9)wH>ketcf#=EpbBv_-u>ut~zifqPD4@?mo}W&;-C4?o>CPx8E4z@6tHEz{7k zuj72~uif=M@voi=eR?Qz#*s@XTX1$uVezYJCqH!^xmdy>xzn^U#Q z;?n+YZ$B=-a=h#8J;uEUa^oF0eqE8T@$Q!CjLN3NHS2BuNq*JUEItzZ$#nOr^LKPR z1pj)>nx*(!EuvtlZb8PH80Ojn&b;35`VVIAS2mcsX6DvYQ{(E-{+gy&9I94(C%NBb zbq&Mw2Yt3N%=vB4mT&4%-o!tz=WeyB-Sg(}?rH@yUmWk+To$z9>+3z?TuCnW0W!C^ zC;a(*{l Date: Fri, 21 Feb 2014 20:43:53 -0500 Subject: [PATCH 2/2] VRFS-1188 VRFS-1189 fix playback issue --- web/app/views/music_sessions/show.html.erb | 22 ++++++++++------------ web/app/views/recordings/show.html.erb | 21 +++++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/web/app/views/music_sessions/show.html.erb b/web/app/views/music_sessions/show.html.erb index 090463280..09649dcd5 100644 --- a/web/app/views/music_sessions/show.html.erb +++ b/web/app/views/music_sessions/show.html.erb @@ -114,32 +114,30 @@ var showMusicSession = new JK.ShowMusicSession(JK.app); showMusicSession.initialize("<%= @music_session.id %>"); - // remainder of this code is related to playing/pausing the session + // remainder of this code is related to playing/pausing the session var htmlAudio = $(".recording-controls").find('audio').get(0); + var $imgPlayPauseSelector = $("#imgPlayPause"); + var playButtonPath = '/assets/content/icon_playbutton.png'; + var pauseButtonPath = '/assets/content/icon_pausebutton.png'; - function formatTime(time) { - var minutes = Math.floor(time / 60); - var seconds = Math.floor(time % 60); - return minutes.toString() + ":" + (seconds > 9 ? seconds.toString() : '0' + seconds.toString()); - } - + // this updates the current play time $(htmlAudio).on('timeupdate', function() { - $(".recording-current").html(formatTime(htmlAudio.currentTime)); + $(".recording-current").html(context.JK.prettyPrintSeconds (htmlAudio.currentTime)); - // reset icon to play and slider to far left when done + // reset icon to play when done if (percentComplete === 100) { - $("#imgPlayPause").attr('src', '/assets/content/icon_playbutton.png'); + $imgPlayPauseSelector.attr('src', playButtonPath); } }); $("#btnPlayPause").click(function() { if (htmlAudio.paused) { htmlAudio.play(); - $("#imgPlayPause").attr('src', '/assets/content/icon_pausebutton.png'); + $imgPlayPauseSelector.attr('src', pauseButtonPath); } else { htmlAudio.pause(); - $("#imgPlayPause").attr('src', '/assets/content/icon_playbutton.png'); + $imgPlayPauseSelector.attr('src', playButtonPath); } }); }); diff --git a/web/app/views/recordings/show.html.erb b/web/app/views/recordings/show.html.erb index cd982c0df..cec8f1caa 100644 --- a/web/app/views/recordings/show.html.erb +++ b/web/app/views/recordings/show.html.erb @@ -66,8 +66,8 @@
0:00
<% if !@claimed_recording.has_mix? %> @@ -114,8 +114,13 @@ var showRecording = new JK.ShowRecording(JK.app); showRecording.initialize("<%= @claimed_recording.id %>", "<%= @claimed_recording.recording_id %>"); + $("#recordingDuration").html(formatTime("<%= @claimed_recording.recording.duration %>")); + // remainder of this code is related to playing/pausing the recording var htmlAudio = $(".recording-controls").find('audio').get(0); + var $imgPlayPauseSelector = $("#imgPlayPause"); + var playButtonPath = '/assets/content/icon_playbutton.png'; + var pauseButtonPath = '/assets/content/icon_pausebutton.png'; var durationInitialized = false; function formatTime(time) { @@ -124,19 +129,15 @@ return minutes.toString() + ":" + (seconds > 9 ? seconds.toString() : '0' + seconds.toString()); } - // this calculates the original + // this sets the slider to the appropriate position and updates the current play time $(htmlAudio).on('timeupdate', function() { - if (!durationInitialized) { - $("#recordingDuration").html(formatTime(htmlAudio.duration)); - durationInitialized = true; - } var percentComplete = (htmlAudio.currentTime / htmlAudio.duration) * 100; $(".recording-slider").css({'left': percentComplete + '%'}); $(".recording-current").html(formatTime(htmlAudio.currentTime)); // reset icon to play and slider to far left when done if (percentComplete === 100) { - $("#imgPlayPause").attr('src', '/assets/content/icon_playbutton.png'); + $imgPlayPauseSelector.attr('src', playButtonPath); $(".recording-slider").css({'left': 0 + '%'}); } }); @@ -144,11 +145,11 @@ $("#btnPlayPause").click(function() { if (htmlAudio.paused) { htmlAudio.play(); - $("#imgPlayPause").attr('src', '/assets/content/icon_pausebutton.png'); + $imgPlayPauseSelector.attr('src', pauseButtonPath); } else { htmlAudio.pause(); - $("#imgPlayPause").attr('src', '/assets/content/icon_playbutton.png'); + $imgPlayPauseSelector.attr('src', playButtonPath); } }); });