From: Steinar H. Gunderson Date: Wed, 17 Jun 2015 20:46:07 +0000 (+0200) Subject: Possibly fix a sound issue related to JSON diffs. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=1c8a5757b9a7c3c694ed3c1c43f7c60a1e4ce84d Possibly fix a sound issue related to JSON diffs. --- diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index d34b4d6..d666342 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -137,12 +137,14 @@ var request_update = function() { sync_server_clock(xhr.getResponseHeader('Date')); ims = xhr.getResponseHeader('X-RGLM'); var num_viewers = xhr.getResponseHeader('X-RGNV'); - possibly_play_sound(current_analysis_data, data); + var new_data; if (Array.isArray(data)) { - current_analysis_data = JSON_delta.patch(current_analysis_data, data); + new_data = JSON_delta.patch(current_analysis_data, data); } else { - current_analysis_data = data; + new_data = data; } + possibly_play_sound(current_analysis_data, new_data); + current_analysis_data = new_data; update_board(current_analysis_data, displayed_analysis_data); update_num_viewers(num_viewers);