Support YouTube videos
This commit is contained in:
parent
646735252f
commit
5bf63fe046
2 changed files with 24 additions and 6 deletions
|
@ -56,13 +56,18 @@
|
|||
{% endautoescape %}
|
||||
|
||||
{% if presentation.videos_split %}
|
||||
<h2 class="mt-4">Video</h4>
|
||||
<h2 class="mt-4">Videos</h4>
|
||||
{% for v in presentation.youtube_videos %}
|
||||
<iframe width="560" height="315" src="{{ v }}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
||||
{% endfor %}
|
||||
{% if v.other_videos %}
|
||||
<video controls style="max-width: 640px">
|
||||
{% for video in presentation.videos_split %}
|
||||
{% for video in presentation.other_videos %}
|
||||
<source src="{{ video }}">
|
||||
{% endfor %}
|
||||
</video>
|
||||
<p style="margin-top: 1rem">Available formats:</p>
|
||||
{% endif %}
|
||||
<p style="margin-top: 1rem">Available sources:</p>
|
||||
<ul>
|
||||
{% for video in presentation.videos_split %}
|
||||
<li>{{ video|urlize }}</li>
|
||||
|
|
13
vendor/symposion/symposion/schedule/models.py
vendored
13
vendor/symposion/symposion/schedule/models.py
vendored
|
@ -308,6 +308,19 @@ class Presentation(models.Model):
|
|||
def videos_split(self):
|
||||
return [v.strip() for v in self.videos.split('\n') if v != '']
|
||||
|
||||
def youtube_videos(self):
|
||||
return [
|
||||
v.replace('youtu.be', 'www.youtube.com/embed')
|
||||
for v in self.videos_split()
|
||||
if 'youtu.be' in v
|
||||
]
|
||||
|
||||
def other_videos(self):
|
||||
return [
|
||||
v for v in self.videos_split()
|
||||
if 'youtu.be' not in v
|
||||
]
|
||||
|
||||
class Meta:
|
||||
ordering = ["slot"]
|
||||
verbose_name = _("presentation")
|
||||
|
|
Loading…
Reference in a new issue