Skip to content

Commit

Permalink
Storyboards: Unescape HTML entities for videojs-vtt-thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
SamantazFox committed Aug 16, 2024
1 parent a335bc0 commit e9694a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/invidious/routes/api/v1/videos.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "html"

module Invidious::Routes::API::V1::Videos
def self.videos(env)
locale = env.get("preferences").as(Preferences).locale
Expand Down Expand Up @@ -221,7 +223,7 @@ module Invidious::Routes::API::V1::Videos
end_time = time_delta - 1.milliseconds

# Build a VTT file for VideoJS-vtt plugin
return WebVTT.build do |vtt|
vtt_file = WebVTT.build do |vtt|
sb.images_count.times do |i|
# Replace the variable component part of the path
work_url.path = template_path.sub("$M", i)
Expand All @@ -239,6 +241,11 @@ module Invidious::Routes::API::V1::Videos
end
end
end

# videojs-vtt-thumbnails is not compliant to the VTT specification, it
# doesn't unescape the HTML entities, so we have to do it here:
# TODO: remove this when we migrate to VideoJS 8
return HTML.unescape(vtt_file)
end

def self.annotations(env)
Expand Down

0 comments on commit e9694a0

Please sign in to comment.