and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

...
 
Commits (4)
......@@ -21,6 +21,7 @@ var options = {
]
},
html5: {
preloadTextTracks: false,
hls: {
overrideNative: true
}
......@@ -547,3 +548,10 @@ window.addEventListener('keydown', e => {
if (player.share) {
player.share(shareOptions);
}
// show the preferred caption by default
if (player_data.preferred_caption_found) {
player.ready(() => {
player.textTracks()[1].mode = 'showing';
});
}
\ No newline at end of file
......@@ -534,7 +534,8 @@ struct Video
end
def live_now
info["videoDetails"]["isLiveContent"]?.try &.as_bool || false
info["microformat"]?.try &.["playerMicroformatRenderer"]?
.try &.["liveBroadcastDetails"]?.try &.["isLiveNow"]?.try &.as_bool || false
end
def is_listed
......
......@@ -24,9 +24,9 @@
<% end %>
<% end %>
<% preferred_captions.each_with_index do |caption, i| %>
<% preferred_captions.each do |caption| %>
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name.simpleText %>&hl=<%= env.get("preferences").as(Preferences).locale %>"
label="<%= caption.name.simpleText %>" <% if i == 0 %>default<% end %>>
label="<%= caption.name.simpleText %>">
<% end %>
<% captions.each do |caption| %>
......@@ -42,7 +42,8 @@
"aspect_ratio" => aspect_ratio,
"title" => video.title,
"description" => HTML.escape(video.short_description),
"thumbnail" => thumbnail
"thumbnail" => thumbnail,
"preferred_caption_found" => !preferred_captions.empty?
}.to_pretty_json
%>
</script>
......
......@@ -81,6 +81,10 @@
<h3>
<%= video.premiere_timestamp.try { |t| translate(locale, "Premieres in `x`", recode_date((t - Time.utc).ago, locale)) } %>
</h3>
<% elsif video.live_now %>
<h3>
<%= video.premiere_timestamp.try { |t| translate(locale, "Started streaming `x` ago", recode_date((Time.utc - t).ago, locale)) } %>
</h3>
<% end %>
</div>
......