Skip to content

Commit 21c13bb

Browse files
committed
chore: use api captions from companion when available
1 parent 5e9d51c commit 21c13bb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/invidious/views/components/player.ecr

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,18 @@
6565
<% end %>
6666
<% end %>
6767

68-
<% preferred_captions.each do |caption| %>
69-
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name %>" label="<%= caption.name %>">
68+
<% preferred_captions.each do |caption|
69+
api_captions_url = "/api/v1/captions/"
70+
api_captions_url = invidious_companion.public_url.to_s + api_captions_url if (invidious_companion)
71+
%>
72+
<track kind="captions" src="<%= api_captions_url %><%= video.id %>?label=<%= caption.name %>" label="<%= caption.name %>">
7073
<% end %>
7174

72-
<% captions.each do |caption| %>
73-
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name %>" label="<%= caption.name %>">
75+
<% captions.each do |caption|
76+
api_captions_url = "/api/v1/captions/"
77+
api_captions_url = invidious_companion.public_url.to_s + api_captions_url if (invidious_companion)
78+
%>
79+
<track kind="captions" src="<%= api_captions_url %><%= video.id %>?label=<%= caption.name %>" label="<%= caption.name %>">
7480
<% end %>
7581
<% end %>
7682
</video>

0 commit comments

Comments
 (0)