From 94ed6bdcf337306df3d1527dee2ed6d9af5ef938 Mon Sep 17 00:00:00 2001 From: Jonathon Wilson Date: Thu, 5 Sep 2013 20:27:43 -0600 Subject: [PATCH] VRFS-601, respond to events for backend mixer changes, and (VRFS-547) hide voice chat prior to rebuild (which draws voice chat controls if appropriate). --- app/assets/javascripts/session.js | 54 +++++++++++++++++++------------ 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/session.js b/app/assets/javascripts/session.js index dbd3e838c..94291c8f2 100644 --- a/app/assets/javascripts/session.js +++ b/app/assets/javascripts/session.js @@ -64,35 +64,45 @@ // recreate eThresholdType enum from MixerDialog.h var alert_type = { - 0: { "title": "", "message": "" }, // packet jitter - 1: { "title": "Packet Loss", "message": "Your network connection is currently experiencing packet loss at a rate that is too high to deliver good audio quality. For troubleshooting tips, click here." }, // packet loss - 2: { "title": "", "message": "" }, // packet late - 3: { "title": "", "message": "" }, // network jitter - 4: { "title": "Session Latency", "message": "The latency of your audio device combined with your Internet connection has become high enough to impact your session quality. For troubleshooting tips, click here." }, // network ping - 5: { "title": "", "message": "" }, // bitrate throttle warning - 6: { "title": "Low Bandwidth", "message": "The available bandwidth on your network has become too low,and this may impact your audio quality. For troubleshooting tips, click here." }, // bandwidth low - 7: { "title": "Input Rate", "message": "The input rate of your audio device is varying too much to deliver good audio quality. For troubleshooting tips, click here." }, // input IO rate - 8: { "title": "", "message": "" }, // input IO jitter - 9: { "title": "Output Rate", "message": "The output rate of your audio device is varying too much to deliver good audio quality. For troubleshooting tips, click here." }, // output IO rate - 10: { "title": "", "message": "" }, // output IO jitter - 11: { "title": "CPU Utilization High", "message": "The CPU of your computer is unable to keep up with the current processing load, and this may impact your audio quality. For troubleshooting tips, click here." }, // CPU load - 12: { "title": "", "message": "" }, // decode violations - 13: { "title": "", "message": "" } // last threshold + 0: {"title": "", "message": ""}, // NO_EVENT, + 1: {"title": "", "message": ""}, // BACKEND_ERROR: generic error - eg P2P message error + 2: {"title": "", "message": ""}, // BACKEND_MIXER_CHANGE, - event that controls have been regenerated + 3: {"title": "", "message": ""}, // PACKET_JTR, + 4: { "title": "Packet Loss", "message": "Your network connection is currently experiencing packet loss at a rate that is too high to deliver good audio quality. For troubleshooting tips, click here." }, // PACKET_LOSS + 5: {"title": "", "message": ""}, // PACKET_LATE, + 6: {"title": "", "message": ""}, // JTR_QUEUE_DEPTH, + 7: {"title": "", "message": ""}, // NETWORK_JTR, + 8: { "title": "Session Latency", "message": "The latency of your audio device combined with your Internet connection has become high enough to impact your session quality. For troubleshooting tips, click here." }, // NETWORK_PING, + 9: {"title": "", "message": ""}, // BITRATE_THROTTLE_WARN, + 10: { "title": "Low Bandwidth", "message": "The available bandwidth on your network has become too low,and this may impact your audio quality. For troubleshooting tips, click here." }, // BANDWIDTH_LOW + //IO related events + 11: { "title": "Input Rate", "message": "The input rate of your audio device is varying too much to deliver good audio quality. For troubleshooting tips, click here." }, // INPUT_IO_RATE + 12: {"title": "", "message": ""}, // INPUT_IO_JTR, + 13: { "title": "Output Rate", "message": "The output rate of your audio device is varying too much to deliver good audio quality. For troubleshooting tips, click here." }, // OUTPUT_IO_RATE + 14: {"title": "", "message": ""}, // OUTPUT_IO_JTR, + // CPU load related + 15: { "title": "CPU Utilization High", "message": "The CPU of your computer is unable to keep up with the current processing load, and this may impact your audio quality. For troubleshooting tips, click here." }, // CPU_LOAD + 16: {"title": "", "message": ""}, // DECODE_VIOLATIONS, + 17: {"title": "", "message": ""} // LAST_THRESHOLD }; + function beforeShow(data) { sessionId = data.id; $('#session-mytracks-container').empty(); } function alertCallback(type, text) { - - context.setTimeout(function() { - app.notify({ - "title": alert_type[type].title, - "text": text, - "icon_url": "/assets/content/icon_alert_big.png" - }); }, 1); + if (type === 2) { // BACKEND_MIXER_CHANGE + renderSession(); // This empties all and hides voice chat, then completely rebuilds. + } else { + context.setTimeout(function() { + app.notify({ + "title": alert_type[type].title, + "text": text, + "icon_url": "/assets/content/icon_alert_big.png" + }); }, 1); + } } function afterShow(data) { @@ -180,6 +190,8 @@ function renderSession() { $('#session-mytracks-container').empty(); $('.session-track').remove(); // Remove previous tracks + var $voiceChat = $('#voice-chat'); + $voiceChat.hide(); _updateMixers(); _renderTracks(); _wireTopVolume();