diff options
author | 2025-03-29 12:35:50 +0530 | |
---|---|---|
committer | 2025-03-29 12:35:50 +0530 | |
commit | 3fbaff704571293be83e2b56d36b761f42cce1ec (patch) | |
tree | 38ff650730359360c21f296b4ad5c47f01f20c30 /youtube/static/js/plyr-start.js | |
parent | a4e01da27c08e43a67b2618ad1e71c1f8f86d5cd (diff) | |
download | yt-local-3fbaff704571293be83e2b56d36b761f42cce1ec.tar.gz yt-local-3fbaff704571293be83e2b56d36b761f42cce1ec.tar.bz2 yt-local-3fbaff704571293be83e2b56d36b761f42cce1ec.zip |
Diffstat (limited to 'youtube/static/js/plyr-start.js')
-rw-r--r-- | youtube/static/js/plyr-start.js | 17 |
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}); })(); |