Skip to content

Commit

Permalink
Display play/pause on click of video element
Browse files Browse the repository at this point in the history
  • Loading branch information
yhbyun committed Jul 25, 2021
1 parent 6088b2a commit f45ff2e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
});
}
Expand Down

0 comments on commit f45ff2e

Please sign in to comment.