diff options
| author | Andrew Zhao <azhao12345@users.noreply.github.com> | 2021-02-24 01:02:55 -0500 |
|---|---|---|
| committer | Andrew Zhao <azhao12345@users.noreply.github.com> | 2021-02-24 01:02:55 -0500 |
| commit | 9b79e35d5280e7c7586e44d18930267f7e5237b6 (patch) | |
| tree | e41b638c019e110e2f4454ef9767d037858c47d5 | |
| parent | cbc7603248341839157d87a2addd0141281880f8 (diff) | |
| download | invidious-9b79e35d5280e7c7586e44d18930267f7e5237b6.tar.gz invidious-9b79e35d5280e7c7586e44d18930267f7e5237b6.tar.bz2 invidious-9b79e35d5280e7c7586e44d18930267f7e5237b6.zip | |
do not preload captions
| -rw-r--r-- | assets/js/player.js | 8 | ||||
| -rw-r--r-- | src/invidious/views/components/player.ecr | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/assets/js/player.js b/assets/js/player.js index 7490bd75..4db6f98d 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -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 diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr index a898a41f..cff3e60a 100644 --- a/src/invidious/views/components/player.ecr +++ b/src/invidious/views/components/player.ecr @@ -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> |
