From 88100e79ad6003c7c1dd90b8ace8f7951e5011a6 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 26 Apr 2012 15:26:07 -0400 Subject: [PATCH] CC-3725: Make it so that ON-AIR light never goes off between tracks. -fixed --- .../public/js/airtime/dashboard/playlist.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/dashboard/playlist.js b/airtime_mvc/public/js/airtime/dashboard/playlist.js index c3b796da8..c61254857 100644 --- a/airtime_mvc/public/js/airtime/dashboard/playlist.js +++ b/airtime_mvc/public/js/airtime/dashboard/playlist.js @@ -20,6 +20,11 @@ var live_dj_on_air = false; var scheduled_play_on_air = false; var scheduled_play_source = false; +//keep track of how many UI refreshes the ON-AIR light has been off for. +//For example, the uiUpdateInterval is every 200ms, so if onAirOffIterations +//is 25, then that means 5 seconds have gone by. +var onAirOffIterations = 0; + //var timezoneOffset = 0; //set to "development" if we are developing :). Useful to disable alerts @@ -326,9 +331,16 @@ function parseSwitchStatus(obj){ } function controlOnAirLight(){ - if((scheduled_play_on_air && scheduled_play_source)|| live_dj_on_air || master_dj_on_air){ + if ((scheduled_play_on_air && scheduled_play_source) || live_dj_on_air || master_dj_on_air) { $('#on-air-info').attr("class", "on-air-info on"); - }else{ + onAirOffIterations = 0; + } else if (onAirOffIterations < 15) { + //if less than 3 seconds have gone by (< 15 executions of this function) + //then keep the ON-AIR light on. Only after at least 3 seconds have gone by, + //should we be allowed to turn it off. This is to stop the light from temporarily turning + //off between tracks: CC-3725 + onAirOffIterations++; + } else { $('#on-air-info').attr("class", "on-air-info off"); } }