Reputation: 371
I want to completely disable full screen functionality. I removed fullscreen button like this.
videojs('videoPlayer', {
controlBar: {
fullscreenToggle: false
}
});
But on double click it still goes to full screen. How to disable double click?
Upvotes: 1
Views: 4185
Reputation: 386
Just I added controlsList="nofullscreen" attribute. But playing the video on click on the center of won't work. So I added onclick="vd.play()" attribute. <video id="vd" src="video.mp4" onclick="vd.play()" disablePictureInPicture controls controlsList="nofullscreen"></video>
Upvotes: 0
Reputation: 674
As of Video.js 7.5.0, there is an an option to turn it off directly
videojs("my-player", {
userActions: {
doubleClick: false
}
});
Upvotes: 4
Reputation: 371
Darius Oleskevicius helped me with the answer on videojs github page: https://github.com/videojs/video.js/issues/5604
The current dblclick
handler doesn't take into consideration whether fullscreen toggle is disabled. It is on by default and there is currently no settable option to disable it. As of now, you could try and cancel out dblclick
listener on tech (see below).
player.ready(function() {
player.tech_.off('dblclick');
});
Also if you use reset function, you have to again remove dblclick
event listener.
Upvotes: 2
Reputation: 2336
You can use CSS to initialize the various control-bar objects to exist or not.
See, for example: https://github.com/videojs/video.js/issues/2507
So, for your case, just use:
<style>
.video-js .vjs-fullscreen-control { display: none; }
</style>
EDIT:
Ok, I figured out what's up with the "double-click" !
I still run all my video pages, using version 5 of videojs.
Version 5.11.9, to be exact.
And, it turns out that double-clicking on a video back then, did NOTHING.
So, bottom line, if you truly 'want to disable 'double-click-to-fullscreen', it can be done. Just use 5.x, rather than 6.x or 7.x
Having said all that, I now have to consider this a bug in 7.x (and 6.x).
The code inside videojs SHOULD be testing whether the fullscreen-control
exists or not, and if not, the double-click should NOT be going to fullscreen.
The list of versions is here: https://github.com/videojs/video.js/releases
Upvotes: 0