From fb3ed71957055c89986240f857ae84e2f4096f0d Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Fri, 6 Mar 2015 23:16:27 -0500 Subject: [PATCH] VRFS-2854 more session widget feed fixes --- .../javascripts/jquery.listenbroadcast.js | 60 +++++++++---------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/web/app/assets/javascripts/jquery.listenbroadcast.js b/web/app/assets/javascripts/jquery.listenbroadcast.js index 00f87fcbe..059b7c18b 100644 --- a/web/app/assets/javascripts/jquery.listenbroadcast.js +++ b/web/app/assets/javascripts/jquery.listenbroadcast.js @@ -92,10 +92,8 @@ .done(function(response) { if(!sessionInfo.mount) { - if (sessionInfo.session_removed_at) { - transition(PlayStateSessionOver); - destroy(); - } + transition(PlayStateSessionOver); + destroy(); } else { try { @@ -122,7 +120,7 @@ } } catch (err) { - console.log("Catching error = %o", err); + logger.log("Catching error = %o", err); } } }) @@ -147,7 +145,7 @@ recreateAudioElement(); } catch (err) { - console.log("Catching error = %o", err); + logger.log("Catching error = %o", err); } } @@ -160,7 +158,7 @@ recreateAudioElement(); } catch (err) { - console.log("Catching error = %o", err); + logger.log("Catching error = %o", err); } // destroyed = true; //} @@ -173,14 +171,21 @@ } function createAudioElementHtml() { - if (sessionInfo == null) throw "no session info"; - if (sessionInfo.mount == null) throw "no session mount info"; + if (sessionInfo == null) { + logger.log("no session info"); + throw "no session info"; + } + + if (sessionInfo.mount == null) { + logger.log("no session mount info"); + throw "no session mount info"; + } $audio = $('') - $parent.append($audio) + ''); + $parent.append($audio); audioDomElement = $audio.get(0); audioBind(); @@ -265,10 +270,8 @@ .done(function(response) { if(!sessionInfo.mount) { - if (sessionInfo.session_removed_at) { - transition(PlayStateSessionOver); - destroy(); - } + transition(PlayStateSessionOver); + destroy(); } else { // tell audio to stop/start, in attempt to retry @@ -292,7 +295,7 @@ waitForBufferingTimeout = setTimeout(noBuffer, WAIT_FOR_BUFFER_TIMEOUT); } catch (err) { - console.log("Catching error = %o", err); + logger.log("Catching error = %o", err); } } }); @@ -400,7 +403,7 @@ function checkServer() { return rest.getSession(musicSessionId) .done(function(response) { - console.log("assigning sessionInfo") + logger.log("assigning sessionInfo") sessionInfo = response; }) .fail(function(jqXHR) { @@ -505,10 +508,8 @@ checkServer() .done(function(response) { if(!sessionInfo.mount) { - if (sessionInfo.session_removed_at) { - transition(PlayStateSessionOver); - destroy(); - } + transition(PlayStateSessionOver); + destroy(); }}); } } @@ -703,26 +704,21 @@ function openBubble() { checkServer().done(function(response) { - var mountId = sessionInfo.mount ? sessionInfo.mount.id : null + var mountId = sessionInfo.mount ? sessionInfo.mount.id : null; if(mountId) { rest.getMount({id: mountId}) .done(function (mount) { - mountInfo = mount - $parent.data('mount-id', mountId) - context.JK.SubscriptionUtils.subscribe('mount', mountId).on(context.JK.EVENTS.SUBSCRIBE_NOTIFICATION, onDetailEvent) - $parent.btOn() + mountInfo = mount; + $parent.data('mount-id', mountId); + context.JK.SubscriptionUtils.subscribe('mount', mountId).on(context.JK.EVENTS.SUBSCRIBE_NOTIFICATION, onDetailEvent); + $parent.btOn(); }) .fail(context.JK.app.ajaxError) } else { mountInfo = null; - - if (sessionInfo.session_removed_at) { - transition(PlayStateSessionOver); - destroy(); - } - + destroy(); context.JK.app.notify({"title": "Unable to Broadcast Session", "text": "This session cannot be broadcasted. The session organizer may have configured it to be private."}); } })