diff options
Diffstat (limited to 'youtube/templates/watch.html')
| -rw-r--r-- | youtube/templates/watch.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 0991457..7432bde 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -85,6 +85,16 @@ <option value='{"type": "pair", "index": {{ loop.index0}}}' {{ 'selected' if loop.index0 == pair_idx and using_pair_sources else '' }} >{{ src_pair['quality_string'] }}</option> {% endfor %} </select> + + {% if audio_tracks and audio_tracks|length > 1 %} + <select id="audio-language-select" autocomplete="off" title="Audio language"> + {% for track in audio_tracks %} + <option value="{{ track.get('track_id', track['language']) }}" {{ 'selected' if loop.index0 == 0 else '' }}> + 🔊 {{ track['language_name'] }}{% if track.get('is_default') %} (Default){% endif %} + </option> + {% endfor %} + </select> + {% endif %} {% endif %} </div> <input class="v-checkbox" name="video_info_list" value="{{ video_info }}" form="playlist-edit" type="checkbox"> @@ -246,6 +256,38 @@ let storyboard_url = {{ storyboard_url | tojson }}; // @license-end </script> + + <!-- Audio language selector handler --> + <script> + // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later + (function() { + 'use strict'; + const audioSelect = document.getElementById('audio-language-select'); + const qualitySelect = document.getElementById('quality-select'); + + if (audioSelect && qualitySelect) { + audioSelect.addEventListener('change', function() { + const selectedAudio = this.value; + const selectedQuality = qualitySelect.value; + + // Parse current quality selection + let qualityData; + try { + qualityData = JSON.parse(selectedQuality); + } catch(e) { + return; + } + + // Reload video with new audio language + const currentUrl = new URL(window.location.href); + currentUrl.searchParams.set('audio_lang', selectedAudio); + window.location.href = currentUrl.toString(); + }); + } + }()); + // @license-end + </script> + <script src="/youtube.com/static/js/common.js"></script> <script src="/youtube.com/static/js/transcript-table.js"></script> {% if settings.use_video_player == 2 %} |
