Skip to content

Commit

Permalink
Merge pull request #292 from jonatron/video_track_captions
Browse files Browse the repository at this point in the history
add vtt to video track
  • Loading branch information
johanvdw authored Feb 12, 2025
2 parents 871ea9d + b9f05a8 commit 9074644
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions layouts/schedule/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

<%
videos = []
videos.push *((item[:attachments] or []).select{|a| a[:mime] == 'video/webm'}.map{|a| $attachments_by_export[a[:filename]][:localname]})
videos.push *((item[:links] or []).select{|l| l[:url] =~ /\.webm$/}.map{|l| l[:url]})
videos
.each do |video|
Expand All @@ -57,11 +56,15 @@
end
require 'uri'
url = video
vtt_url = item[:links].find { |l| l[:url].end_with?('.vtt') }&.[](:url)
%>
<div class="video">
<video preload="none" controls="controls" width="75%">
<video preload="none" controls="controls" width="75%" crossorigin="anonymous">
<source src="<%= url %>" type='video/webm; codecs="av01.0.08M.08.0.110.01.01.01.0"' />
<source src="<%= url.gsub(/\.av1\.webm$/, ".mp4") %>" type='video/mp4' />
<% if vtt_url %>
<track src="<%= vtt_url %>" label="Captions" kind="captions" srclang="en" />
<% end %>
</video>
</div>
<% end %>
Expand Down

0 comments on commit 9074644

Please sign in to comment.