aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--youtube/templates/watch.html22
-rw-r--r--youtube/watch.py2
2 files changed, 17 insertions, 7 deletions
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html
index 9a80c68..f05fc81 100644
--- a/youtube/templates/watch.html
+++ b/youtube/templates/watch.html
@@ -404,15 +404,22 @@
crossorigin="anonymous"></script>
<script>
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
+ let captionsActive;
+ switch(true) {
+ case data.settings.subtitles_mode == 2:
+ captionsActive = true;
+ break;
+ case data.settings.subtitles_mode == 1 && data.has_manual_captions:
+ captionsActive = true;
+ break;
+ default:
+ captionsActive = false;
+ }
const player = new Plyr(document.getElementById('js-video-player'), {
disableContextMenu: false,
captions: {
- {% if settings.subtitles_mode > 0 %}
- active: true,
- {% else %}
- active: false,
- {% endif %}
- language: '{{ settings.subtitles_language }}'
+ active: captionsActive,
+ language: data.settings.subtitles_language,
},
controls: [
'play-large',
@@ -427,7 +434,8 @@
],
iconUrl: "/youtube.com/static/modules/plyr/plyr.svg",
blankVideo: "/youtube.com/static/modules/plyr/blank.webm",
- debug: false
+ debug: false,
+ storage: {enabled: false},
});
// @license-end
</script>
diff --git a/youtube/watch.py b/youtube/watch.py
index 094f8b5..3bee71f 100644
--- a/youtube/watch.py
+++ b/youtube/watch.py
@@ -556,6 +556,8 @@ def get_watch_page(video_id=None):
js_data = {
'video_id': video_info['id'],
+ 'settings': settings.current_settings_dict,
+ 'has_manual_captions': any(s.get('on') for s in subtitle_sources),
},
# for embed page
font_family=youtube.font_choices[settings.font],