url("^playlists/list/(?P<type>.*)$", PlaylistListView.as_view(), name="organization-playlist-list"),
url("^playlists/overlay/(?P<slug>.*)/$", 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<slug>.*)/detail/$", LiveStreamingDetailView.as_view(), name="organization-streaming-detail"),
+ url("^streamings/(?P<slug>.*)/(?P<type>.*)/detail/$", LiveStreamingDetailView.as_view(), name="organization-streaming-detail"),
]
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
$('#countdown').html('<br />');
}
-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('<br /><br />');
- $('#'+id).html('<br />');
- $('#live').html('- Live !');
+ // $('#countdown-title').html('<br /><br />');
+ // $('#'+id).html('<br />');
+ // $('#live').html('- Live !');
//switchVideo(video_id, video_url);
+ $('.countdown-overlay').hide()
+ nextEvent()
return;
}
}
+ 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);
}
#{$module} {
+ .intro {
+ margin-bottom : 30px;
+ }
& .page__content {
text-align: center;
}
- .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;
}
{% endblock %}
{% block page_content %}
- {% if object.type = "youtube" %}
+
+ {% if type == "youtube" %}
{% if object.youtube_id %}
+ <p class="intro">If YouTube streaming is not working, try HTML5 version by <a href="{% url 'organization-streaming-detail' slug 'html5' %}" title="">clicking here</a></>
+
<div style="position:relative;height:0;padding-bottom:75.0%">
- <iframe src="https://www.youtube.com/embed/{{ object.youtube_id }}?ecver=2" width="1280" height="720" frameborder="0" style="position:absolute;width:100%;height:100%;left:0" allowfullscreen></iframe>
+ <iframe src="https://www.youtube.com/embed/{{ object.youtube_id }}?ecver=2" width="1280" height="720" frameborder="0" allowfullscreen></iframe>
</div>
{% else %}
<p>Please fill youtube id</p>
{% endif %}
- {% elif object.type = "html5" %}
+ {% elif type == "html5" %}
{% if object.html5_url %}
+ <p class="intro">If HTML5 streaming is not working, try Youtube version by <a href="{% url 'organization-streaming-detail' slug 'youtube' %}" title="">clicking here</a></>
+
<video id="live-streaming" width="1280" height="720" controls autoplay>
<source src="{{ object.html5_url }}" type="video/webm">
</video>
{% endif %}
{% endif %}
- <div class="overlay">
+ <div class="countdown-overlay">
<div id="countdown-title"></div>
<div id="countdown"></div>
</div>
<script src="{% static "src/js/modules/live-streaming-counter.js" %}"></script>
<script type="text/javascript">
- var countdowndate = '{{ next_event.start|format_iso }}';
- CountDownTimer(countdowndate, 'countdown', 'live-streaming');
+ var d_begin = '{{ next_event.start|format_iso }}';
+ var d_end = '{{ next_event.end|format_iso }}';
+ CountDownTimer(d_begin, d_end, 'countdown', 'live-streaming');
</script>
{% endblock %}