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
1 changed files with 8 additions and 4 deletions

View File

@ -3,10 +3,14 @@
{% load static %}
{% load humanize %}
<div class="video-main">
<video
src="/media/{{ video.media_url }}"
poster="/cache/{{ video.vid_thumb_url }}" controls preload="false"
type='video/mp4' width="100%" playsinline id="video-item" ontimeupdate="onVideoProgress('{{ video.youtube_id }}')" onloadedmetadata="setVideoProgress(0)">
<video poster="/cache/{{ video.vid_thumb_url }}" controls preload="false" width="100%" playsinline
id="video-item" ontimeupdate="onVideoProgress('{{ video.youtube_id }}')" onloadedmetadata="setVideoProgress(0)">
<source src="/media/{{ video.media_url }}" type="video/mp4">
{% 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>
</div>
<div class="boxed-content">