Skip to content

Commit 9074644

Browse files
authoredFeb 12, 2025
Merge pull request #292 from jonatron/video_track_captions
add vtt to video track
2 parents 871ea9d + b9f05a8 commit 9074644

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎layouts/schedule/event.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
<%
4343
videos = []
44-
videos.push *((item[:attachments] or []).select{|a| a[:mime] == 'video/webm'}.map{|a| $attachments_by_export[a[:filename]][:localname]})
4544
videos.push *((item[:links] or []).select{|l| l[:url] =~ /\.webm$/}.map{|l| l[:url]})
4645
videos
4746
.each do |video|
@@ -57,11 +56,15 @@
5756
end
5857
require 'uri'
5958
url = video
59+
vtt_url = item[:links].find { |l| l[:url].end_with?('.vtt') }&.[](:url)
6060
%>
6161
<div class="video">
62-
<video preload="none" controls="controls" width="75%">
62+
<video preload="none" controls="controls" width="75%" crossorigin="anonymous">
6363
<source src="<%= url %>" type='video/webm; codecs="av01.0.08M.08.0.110.01.01.01.0"' />
6464
<source src="<%= url.gsub(/\.av1\.webm$/, ".mp4") %>" type='video/mp4' />
65+
<% if vtt_url %>
66+
<track src="<%= vtt_url %>" label="Captions" kind="captions" srclang="en" />
67+
<% end %>
6568
</video>
6669
</div>
6770
<% end %>

0 commit comments

Comments
 (0)