-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Disable play/pause on click of video element? Start play only on click of BigPlayButton. #2444
Comments
Why do you want only the big play button clickable? There's not a built in way to turn that off easily. |
It would be nice to have this in scenarios like rtmp streams where you might want the video to keep playing in case of accidental clicks but still want the player controls to function. I've found some stackoverflow questions about removing click handler of video.js Flash player but none of the workarounds I've tried worked with the latest minified versions. |
Probably the best way is to add this to your css: .vjs-tech {
pointer-events: none;
} The downside is that this wont work in IE8. |
Going to close this for now as it's unlikely we'll do anything in videojs about this. |
.video-js.vjs-playing .vjs-tech {
pointer-events: none;
} I think this is good enough for our use case, thanks @gkatsev. |
No problem. |
Hi ,I would like to know if there is a method to disable the default video onclick play/pause method so that i could do some other thing when the video is clicked? Thanks very much! |
Is there any way in latest version 5.10.4 to disable play/pause when there is a click on the video? I tried following but it doesn't work. .video-js.vjs-playing .vjs-tech {
pointer-events: none;
} |
This is not a good solution for me because i just want the "mouse left click" to be disabled. |
Little update to this thread: For me
worked, however it doesnt work for Safari 11 and also none of the above mentioned css rules worked in Safari. Any ideas for Safari? (there is still option to attach play function into pause event but its not very nice solution) |
Our use case is a client embedding a (Brightcove) video in a carousel (Slick) slide. We'd like the video to only start when clicking the Big Play Button (that's....whats it's for), because if they click anywhere on the video itself to drag and move to the next slide, the video starts, and continues playing offscreen (which is a separate issue). |
any updates? |
ok, I've found not elegant way to do this. I use videojs 7.5.5 . I've added additional code to
Then init my player by:
And it works for me |
@dkirilenko Are you able to share any more information about this? |
Another (hacky) workaround (in 7.7.3) is:
My use is case is just for a dumb personal site that plays an HLS live stream that fills up the entire page. I prefer accidental clicks to not pause the stream. |
@lasersocks Hmm :)
I haven't idea what information you need more ) |
@lasersocks see @chenxiaolong comment and try it, if you don't want to change script source. In my case we use player in several places and as for me will be better just to pass additional option where we need |
@gkatsev I think we need to open task again :) So many people who wants to have such possibility without css hook |
This is something that we need as well. Our use case is for syncing video playback across multiple browsers and only allowing a single user to control playback. We'd still like all instances to see progress and be able to select captions, etc. We're using this in angular via npm so manually editing the js file feels incredibly hacky and brittle. Currently, the only way to do this is for us to disable controls in videojs and provide our own playback controls. |
Please please please reopen task |
please reopen stack, i tried @dkirilenko's answer and it is not working.. |
My use case is a live streaming video integrated with AWS IVS and once the user clicks play, I would like to not pause the stream due to accidental clicks on the whole video. The suggested CSS change worked on Chrome, looking for alternatives for all browsers. Thank you for making and sharing video.js 💜 |
@cabello You can put an absolute positioned div on top of the video. Just make sure that you select a proper z-index. |
ref: Line 1336 in ba47953
|
in my case, i try this; thats worked fine |
Hi,
I want to play/pause the video only when clicked on BigPlayButton not any other place of the video element.
I am referring libraries from -
Please let me know how i can achieve this.
The text was updated successfully, but these errors were encountered: