From: Emilie Date: Wed, 15 Mar 2017 10:50:40 +0000 (+0100) Subject: [Vertigo M&C] live streaming > url to switch X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=52d3fd6ba79fa962c8bfccb8ed0b9389ea1b6a62;p=mezzo.git [Vertigo M&C] live streaming > url to switch --- diff --git a/app/organization/media/urls.py b/app/organization/media/urls.py index abdd7787..7a50bd6b 100644 --- a/app/organization/media/urls.py +++ b/app/organization/media/urls.py @@ -40,5 +40,5 @@ urlpatterns = [ url("^playlists/list/(?P.*)$", PlaylistListView.as_view(), name="organization-playlist-list"), url("^playlists/overlay/(?P.*)/$", PlaylistOverlayView.as_view(), name="organization-playlist-overlay"), url("^playlist-media-autocomplete/$", permission_required('playlist.can_edit')(PlayListMediaView.as_view()), name='media-autocomplete'), - url("^streamings/(?P.*)/detail/$", LiveStreamingDetailView.as_view(), name="organization-streaming-detail"), + url("^streamings/(?P.*)/(?P.*)/detail/$", LiveStreamingDetailView.as_view(), name="organization-streaming-detail"), ] diff --git a/app/organization/media/views.py b/app/organization/media/views.py index 0f1c8d25..8b834d3b 100644 --- a/app/organization/media/views.py +++ b/app/organization/media/views.py @@ -137,5 +137,15 @@ class LiveStreamingDetailView(SlugMixin, DetailView): def get_context_data(self, **kwargs): context = super(LiveStreamingDetailView, self).get_context_data(**kwargs) + print("LIVE_STREAMING_TYPE_CHOICES", LIVE_STREAMING_TYPE_CHOICES) + type_choices = [] + for st in LIVE_STREAMING_TYPE_CHOICES: + type_choices.append(st[0]) + if not self.kwargs['type'] in type_choices: + context['type'] = "html5" + else : + context['type'] = self.kwargs['type'] + + context['slug'] = self.object.slug context['next_event'] = Event.objects.filter(location=self.object.event_location).filter(start__gt=datetime.now()).first() return context 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 323b6e15..ee0f1653 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 @@ -32,27 +32,31 @@ function cleanCounter() { $('#countdown').html('
'); } -function CountDownTimer(dt, id, video_id/*, video_url*/) +function CountDownTimer(dt_begin, dt_end, id, video_id/*, video_url*/) { - var end = new Date(dt); + var begin = new Date(dt_begin); + var end = new Date(dt_end); var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour * 24; var timer; + var now = new Date(); + function showRemaining() { - var now = new Date(); - var distance = end - now; + var distance = begin - now; if (distance < 0) { clearInterval(timer); - $('#countdown-title').html('

'); - $('#'+id).html('
'); - $('#live').html('- Live !'); + // $('#countdown-title').html('

'); + // $('#'+id).html('
'); + // $('#live').html('- Live !'); //switchVideo(video_id, video_url); + $('.countdown-overlay').hide() + nextEvent() return; } @@ -70,6 +74,18 @@ function CountDownTimer(dt, id, video_id/*, video_url*/) } + function nextEvent() { + var distance = end - now; + + if (distance < 0) { + $('.countdown-overlay').show() + + } + } + + // calculer le diff avec le prochain évènement + // réactiver le countdown + timer = setInterval(showRemaining, 1000); } diff --git a/app/themes/base/static/src/sass/modules/_live-streaming.scss b/app/themes/base/static/src/sass/modules/_live-streaming.scss index 8fb6e446..a66cc381 100644 --- a/app/themes/base/static/src/sass/modules/_live-streaming.scss +++ b/app/themes/base/static/src/sass/modules/_live-streaming.scss @@ -22,6 +22,9 @@ $module: ".page--live-streaming"; #{$module} { + .intro { + margin-bottom : 30px; + } & .page__content { text-align: center; @@ -32,20 +35,28 @@ $module: ".page--live-streaming"; } - .overlay { - background: #FFFFFF; - position:relative; - top:-260px; - z-index:90; + .countdown-overlay { + background: #000000 none repeat scroll 0 0; color: white; - font-size:1.3em; + font-size: 2em; height: 720px; + left: 70px; + position: absolute; + top: 60px; + width: 1280px; + z-index: 90; + vertical-align: auto; + font-family: "Oswald",sans-serif; + } + + #countdown-title { + margin-top: 5em; } #countdown { margin-top: 1em; font-weight: bold; - color: red; + color: white; } 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 11a142e6..486e9f66 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,16 +18,21 @@ {% endblock %} {% block page_content %} - {% if object.type = "youtube" %} + + {% 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 object.type = "html5" %} + {% elif type == "html5" %} {% if object.html5_url %} +

If HTML5 streaming is not working, try Youtube version by clicking here + @@ -36,7 +41,7 @@ {% endif %} {% endif %} -

+
@@ -47,7 +52,8 @@ {% endblock %}