How to block double click on a video?

0

I created a page with a video set to the resolution and layout that I want, but when I double-click it it goes into fullscreen mode, I would like to disable it. I used the script :

<script>
$(document).ready(function(){
$("*").dblclick(function(e){
e.preventDefault();
});
});
</script>

But even so, the browser (Chrome) supports double-clicking and places the video in fullscreen .

    
asked by anonymous 13.11.2017 / 14:30

2 answers

1

Try:

$("body").on('dblclick', function(){
   return false;
});

If it's a iframe you can use:

<iframe allowfullscreen="0" src="https://www.youtube.com/embed/@(item.VideoUrl)"></iframe>
    
13.11.2017 / 14:54
1

I suggest using a JS API for this because this event is still having problems in some browsers ... A simple and good api for video is the video.js in it you can block the fullscreen perfectly, see the example:

HTML:

  <video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="340" height="268">
    <source src="http://vjs.zencdn.net/v/oceans.mp4"type='video/mp4'><sourcesrc="http://vjs.zencdn.net/v/oceans.webm" type='video/webm'>
  </video>

JS:

videojs('my_video_1', {
  controlBar: {
    fullscreenControl: false
  }
});

Example

    
13.11.2017 / 15:06