restructure video tag to add subtitle tracks

This commit is contained in:
simon 2022-02-06 00:08:24 +07:00
parent e98ffc0050
commit 1664b0d4fc
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -3,10 +3,14 @@
{% load static %} {% load static %}
{% load humanize %} {% load humanize %}
<div class="video-main"> <div class="video-main">
<video <video poster="/cache/{{ video.vid_thumb_url }}" controls preload="false" width="100%" playsinline
src="/media/{{ video.media_url }}" id="video-item" ontimeupdate="onVideoProgress('{{ video.youtube_id }}')" onloadedmetadata="setVideoProgress(0)">
poster="/cache/{{ video.vid_thumb_url }}" controls preload="false" <source src="/media/{{ video.media_url }}" type="video/mp4">
type='video/mp4' width="100%" playsinline id="video-item" ontimeupdate="onVideoProgress('{{ video.youtube_id }}')" onloadedmetadata="setVideoProgress(0)"> {% if video.subtitles %}
{% for subtitle in video.subtitles %}
<track label="{{subtitle.name}}" kind="subtitles" srclang="{{subtitle.lang}}" src="/media/{{subtitle.media_url}}">
{% endfor %}
{% endif %}
</video> </video>
</div> </div>
<div class="boxed-content"> <div class="boxed-content">