From: Emilie Date: Thu, 16 Mar 2017 19:52:51 +0000 (+0100) Subject: [Vertigo M&C] : disable video meanwhile countdown X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=34d9b3b56b46fbaa7474c1ca965e7ba26fca7a4e;p=mezzo.git [Vertigo M&C] : disable video meanwhile countdown --- diff --git a/app/themes/base/static/src/js/modules/live-streaming-counter.js b/app/themes/base/static/src/js/modules/live-streaming-counter.js index 3b6f4c24..94270dd7 100644 --- a/app/themes/base/static/src/js/modules/live-streaming-counter.js +++ b/app/themes/base/static/src/js/modules/live-streaming-counter.js @@ -34,7 +34,7 @@ function cleanCounter(timer) { $('.countdown-overlay').show(); } -function CountDownTimer(json_event, id, video_id) +function CountDownTimer(json_event, id, video_id, video_container) { var curr_event; @@ -48,8 +48,10 @@ function CountDownTimer(json_event, id, video_id) var timer; var distance_out = 1; var distance_in = 1; + var video_html; function init() { + if (Object.keys(json_event).length > 0 ) { curr_event = json_event[curr_event_index]; begin = moment(new Date(curr_event.begin)); @@ -65,24 +67,27 @@ function CountDownTimer(json_event, id, video_id) var distance_out = begin.diff(now); updateDisplay(distance_out); if (distance_out < 0) { - //clearInterval(timer); - // $('#countdown-title').html('

'); - // $('#'+id).html('
'); - // $('#live').html('- Live !'); - //switchVideo(video_id, video_url); + if ($(video_container).is(':empty')){ + $(video_container).html(video_html); + } $('.countdown-overlay').hide(); hideRemaining(); + distance_out = 0; } } function hideRemaining() { - var now = moment().tz("Europe/Paris").format(); //moment(new Date()); + var now = moment().tz("Europe/Paris").format(); var distance_in = end.diff(now); if (distance_in < 0) { nextEvent(); showRemaining(); + if (! $(video_container).is(':empty')){ + $(video_container).empty(); + } $('.countdown-overlay').show(); + distance_in = 0; } } @@ -111,19 +116,21 @@ function CountDownTimer(json_event, id, video_id) } function start() { - // out of event - if (distance_out > 0) { - showRemaining(); - } + // out of event + if (distance_out > 0) { + showRemaining(); + } - // meanwhile an event - if (distance_in > 0) { - hideRemaining(); - } + // meanwhile an event + if (distance_in > 0) { + hideRemaining(); + } } // initialize + video_html = $(video_container).html(); + $(video_container).empty(); init(); } diff --git a/app/themes/base/templates/media/live_streaming/live_streaming_detail.html b/app/themes/base/templates/media/live_streaming/live_streaming_detail.html index 95bc7305..b0265ed5 100644 --- a/app/themes/base/templates/media/live_streaming/live_streaming_detail.html +++ b/app/themes/base/templates/media/live_streaming/live_streaming_detail.html @@ -18,25 +18,25 @@ {% endblock %} {% block page_content %} - - {% if type == "youtube" %} - {% if object.youtube_id %} -

If YouTube streaming is not working, try HTML5 version by clicking here

- - {% else %} -

Please fill youtube id

- {% endif %} - {% elif type == "html5" %} - {% if object.html5_url %} -

If HTML5 streaming is not working, try Youtube version by clicking here

- - {% else %} -

Please fill html5 live streaming url

+
+ {% if type == "youtube" %} + {% if object.youtube_id %} +

If YouTube streaming is not working, try HTML5 version by clicking here

+ + {% else %} +

Please fill youtube id

+ {% endif %} + {% elif type == "html5" %} + {% if object.html5_url %} +

If HTML5 streaming is not working, try Youtube version by clicking here

+ + {% else %} +

Please fill html5 live streaming url

+ {% endif %} {% endif %} - {% endif %} - +
@@ -49,6 +49,6 @@ {% endblock %}