From f45ff2e3ad996b84f225b2434f3d314436872552 Mon Sep 17 00:00:00 2001 From: YongHun Byun Date: Sun, 25 Jul 2021 20:55:39 +0900 Subject: [PATCH] Display play/pause on click of video element https://github.com/videojs/video.js/issues/2444 --- src/App.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/App.vue b/src/App.vue index 14f25d3..20f4c1b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -35,6 +35,11 @@ function createVideoHtml(source, poster) { return videoHtml; } +function disableMouseClick(player) { + // https://github.com/videojs/video.js/issues/2444 + player.el_.firstChild.style.pointerEvents = 'none'; +} + export default { name: 'app', mounted () { @@ -62,6 +67,7 @@ export default { let vid = document.getElementById("my-video"); let player = videojs(vid); + disableMouseClick(player); document.onkeydown = (event) => { console.log("onkeypress", event); @@ -94,12 +100,14 @@ export default { vid = document.getElementById('my-video'); if (message.type === 'native') { player = videojs(vid); + disableMouseClick(player); player.play(); } else if (message.type === 'stream') { player = videojs(vid, { techOrder: ['StreamPlay'], StreamPlay: { duration: message.duration } }, () => { + disableMouseClick(player); player.play() }); }