diff options
Diffstat (limited to 'youtube/templates')
-rw-r--r-- | youtube/templates/watch.html | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 912237a..450ba60 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -56,6 +56,30 @@ </figure> <script src="/youtube.com/static/js/av-merge.js"></script> + <script> + function changeQuality(selection) { + var video = document.getElementById('js-video-player'); + var currentVideoTime = video.currentTime; + var videoPaused = video.paused; + var videoSpeed = video.playbackRate; + var videoSource; + if (avMerge) + avMerge.close(); + if (selection.type == 'uni'){ + videoSource = data['uni_sources'][selection.index]; + video.src = videoSource.url; + } else { + let srcPair = data['pair_sources'][selection.index]; + videoSource = srcPair[0]; + avInitialize(video, srcPair, currentVideoTime); + } + video.currentTime = currentVideoTime; + if (!videoPaused){ + video.play(); + } + video.playbackRate = videoSpeed; + } + </script> {% if using_pair_sources %} <!-- Initialize av-merge --> <script> @@ -104,7 +128,7 @@ <script src="/youtube.com/static/js/speedyplay.js"></script> <select id="quality-select"> {% for src in uni_sources %} - <option value='{"type": "uni", "index": {{ loop.index0 }}}' {{ 'selected' if loop.index0 == uni_idx and not using_pair_sources else '' }} >{{ src['quality_string'] }} (integrated)</option> + <option value='{"type": "uni", "index": {{ loop.index0 }}}' {{ 'selected' if loop.index0 == uni_idx and not using_pair_sources else '' }} >{{ src['quality_string'] }}</option> {% endfor %} {% for src_pair in pair_sources %} <option value='{"type": "pair", "index": {{ loop.index0}}}' {{ 'selected' if loop.index0 == pair_idx and using_pair_sources else '' }} >{{ src_pair[0]['quality_string'] }}, {{ src_pair[1]['quality_string'] }}</option> @@ -113,28 +137,7 @@ <script> document.getElementById('quality-select').addEventListener( 'change', function(e) { - var video = document.getElementById('js-video-player'); - var selection = JSON.parse(this.value); - var currentVideoTime = video.currentTime; - var videoPaused = video.paused; - var videoSpeed = video.playbackRate; - var videoSource; - if (avMerge) - avMerge.close(); - if (selection.type == 'uni'){ - videoSource = data['uni_sources'][selection.index]; - video.src = videoSource.url; - } else { - let srcPair = data['pair_sources'][selection.index]; - videoSource = srcPair[0]; - avInitialize(video, srcPair, currentVideoTime); - } - setVideoDimensions(videoSource.height, videoSource.width); - video.currentTime = currentVideoTime; - if (!videoPaused){ - video.play(); - } - video.playbackRate = videoSpeed; + changeQuality(JSON.parse(this.value)) } ); </script> @@ -445,11 +448,6 @@ </div> - <script> - // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later - data = {{ js_data|tojson }}; - // @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 %} |