aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/static/js/plyr-start.js
diff options
context:
space:
mode:
authorAstound <kirito@disroot.org>2025-03-03 08:20:41 +0800
committerAstound <kirito@disroot.org>2025-03-03 08:20:41 +0800
commitf64b36260381fe46b739a9821d3e850e82e5848b (patch)
tree8a211a52d54fc1765c3b182f4c0fe123ca066f46 /youtube/static/js/plyr-start.js
parent2fd79101949f2332fad7157237518c4804c8b23b (diff)
downloadyt-local-f64b36260381fe46b739a9821d3e850e82e5848b.tar.lz
yt-local-f64b36260381fe46b739a9821d3e850e82e5848b.tar.xz
yt-local-f64b36260381fe46b739a9821d3e850e82e5848b.zip
update logic plyr-start.js
Diffstat (limited to 'youtube/static/js/plyr-start.js')
-rw-r--r--youtube/static/js/plyr-start.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/youtube/static/js/plyr-start.js b/youtube/static/js/plyr-start.js
index 56068f0..3838acc 100644
--- a/youtube/static/js/plyr-start.js
+++ b/youtube/static/js/plyr-start.js
@@ -58,7 +58,7 @@
},
});
- const player = new Plyr(document.getElementById('js-video-player'), {
+ const playerOptions = {
// Learning about autoplay permission https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/autoplay#syntax
autoplay: autoplayActive,
disableContextMenu: false,
@@ -117,5 +117,20 @@
tooltips: {
controls: true,
},
+ }
+
+ const player = new Plyr(document.getElementById('js-video-player'), playerOptions);
+
+ // disable double click to fullscreen
+ // https://github.com/sampotts/plyr/issues/1370#issuecomment-528966795
+ player.eventListeners.forEach(function(eventListener) {
+ if(eventListener.type === 'dblclick') {
+ eventListener.element.removeEventListener(eventListener.type, eventListener.callback, eventListener.options);
+ }
});
+
+ // Add .started property, true after the playback has been started
+ // Needed so controls won't be hidden before playback has started
+ player.started = false;
+ player.once('playing', function(){this.started = true});
})();