Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Video.js - preventing click-to-play functionality

I'm using video.js to embed a video into an HTML page. It is to be used as a ipad-only web app so I believe that it's using the native HTML5 player. I'm trying to disable the click-to-play functionality (so that the user must use the controls) but I am having trouble doing so.

I've tried unbinding the click event (using jQuery) form the video/video player/poster and I've tried using addevent to add e.preventDefault() to the video but none of this seems to work.

Ps. I found a couple of posts saying you could comment out a line in the code, but this line doesn't exist in my version - maybe the plugin has been rewritten.

like image 279
Joe Czucha Avatar asked Apr 18 '13 12:04

Joe Czucha


People also ask

Can video JS play YouTube videos?

Video.js is a web video player built from the ground up for an HTML5 world. It supports HTML5 video and modern streaming formats, as well as YouTube, Vimeo, and even Flash (through plugins, more on that later). It supports video playback on desktop and mobile devices.


2 Answers

Check here

https://github.com/videojs/video.js/blob/master/docs/api/vjs.MediaTechController.md#removecontrolslisteners

So for example

v = videojs('scene04-video');
v.tech.removeControlsListeners();
like image 91
commonpike Avatar answered Nov 16 '22 07:11

commonpike


You can try this. It helped me. Just add this to css file:

.video-js.vjs-playing .vjs-tech {
  pointer-events: none;
}
like image 21
Optio Avatar answered Nov 16 '22 05:11

Optio