From e01491aa862e09328aa4bc061b411a80a3622348 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 3 Mar 2014 23:11:54 -0600 Subject: [PATCH] * VRFS-1330 - load recordings again --- web/app/assets/javascripts/jquery.listenbroadcast.js | 5 +++++ web/app/assets/javascripts/session.js | 4 +++- web/app/assets/javascripts/sessionModel.js | 10 +++++----- web/app/views/users/_feed_music_session.html.haml | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/web/app/assets/javascripts/jquery.listenbroadcast.js b/web/app/assets/javascripts/jquery.listenbroadcast.js index 64fe302a6..125e7ea5c 100644 --- a/web/app/assets/javascripts/jquery.listenbroadcast.js +++ b/web/app/assets/javascripts/jquery.listenbroadcast.js @@ -38,6 +38,7 @@ var audioDomElement = null; var musicSessionId = null; var waitForBufferingTimeout = null; + var fanAccess = null; var retryAttempts = 0; var self = this; @@ -381,6 +382,10 @@ musicSessionId = $parent.attr('data-music-session'); if(!musicSessionId) throw "data-music-session must be specified on $parentElement"; + fanAccess = $parent.attr('fan-access'); + if(fanAccess === null) throw 'fan-access must be specified in $parentElement'; + fanAccess = $parent.attr('fan-access') === 'true' // coerce to boolean + $audio = $('audio', $parent); if($audio.length == 0) { diff --git a/web/app/assets/javascripts/session.js b/web/app/assets/javascripts/session.js index 89c11cdd0..262061289 100644 --- a/web/app/assets/javascripts/session.js +++ b/web/app/assets/javascripts/session.js @@ -186,7 +186,9 @@ }); }) }, 100); - + } + else if(sessionModel.id() && text == 'RebuildMediaControl') { + sessionModel.refreshCurrentSession(true); } } else if (type === 19) { // NO_VALID_AUDIO_CONFIG diff --git a/web/app/assets/javascripts/sessionModel.js b/web/app/assets/javascripts/sessionModel.js index 45f16d8a0..59b06530c 100644 --- a/web/app/assets/javascripts/sessionModel.js +++ b/web/app/assets/javascripts/sessionModel.js @@ -163,10 +163,10 @@ /** * Refresh the current session, and participants. */ - function refreshCurrentSession() { + function refreshCurrentSession(force) { // XXX use backend instead: https://jamkazam.atlassian.net/browse/VRFS-854 //logger.debug("SessionModel.refreshCurrentSession(" + currentSessionId +")"); - refreshCurrentSessionRest(sessionChanged); + refreshCurrentSessionRest(sessionChanged, force); } /** @@ -200,7 +200,7 @@ * Reload the session data from the REST server, calling * the provided callback when complete. */ - function refreshCurrentSessionRest(callback) { + function refreshCurrentSessionRest(callback, force) { var url = "/api/sessions/" + currentSessionId; if(requestingSessionRefresh) { // if someone asks for a refresh while one is going on, we ask for another to queue up @@ -213,7 +213,7 @@ type: "GET", url: url, success: function(response) { - if(currentTrackChanges < response.track_changes_counter) { + if(force === true || currentTrackChanges < response.track_changes_counter) { logger.debug("updating current track changes from %o to %o", currentTrackChanges, response.track_changes_counter) currentTrackChanges = response.track_changes_counter; sendClientParticipantChanges(currentSession, response); @@ -232,7 +232,7 @@ if(pendingSessionRefresh) { // and when the request is done, if we have a pending, fire it off again pendingSessionRefresh = false; - refreshCurrentSessionRest(sessionChanged); + refreshCurrentSessionRest(sessionChanged, force); } } }); diff --git a/web/app/views/users/_feed_music_session.html.haml b/web/app/views/users/_feed_music_session.html.haml index d65f880d2..119edeaa2 100644 --- a/web/app/views/users/_feed_music_session.html.haml +++ b/web/app/views/users/_feed_music_session.html.haml @@ -15,7 +15,7 @@ / timeline and controls .right.w40 / recording play controls - .session-controls{ class: (feed_item.is_over? ? 'ended' : 'inprogress'), 'data-music-session' => feed_item.id } + .session-controls{ class: (feed_item.is_over? ? 'ended' : 'inprogress'), 'data-music-session' => feed_item.id, 'fan-access' => feed_item.fan_access} / session status %a.left.play-button{href:'#'} = image_tag 'content/icon_playbutton.png', width:20, height:20, class:'play-icon' @@ -23,7 +23,7 @@ %audio{preload: 'none'} %source{src: feed_item.music_session.mount.url, type: feed_item.music_session.mount.resolve_string(:mime_type)} .session-status - = feed_item.is_over? ? 'SESSION ENDED' : 'SESSION IN PROGRESS' + = feed_item.is_over? ? 'SESSION ENDED' : (feed_item.fan_access ? 'SESSION IN PROGRESS' : 'PRIVATE SESSION') / current playback time = session_duration(feed_item, class: 'session-duration tick-duration recording-current', 'data-created-at' => feed_item.created_at.to_i) / end recording play controls