Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 video - disable fullscreen only

Tags:

html

video

I am using the video tag for my page, and I am trying to exclude the fullscreen from the controls.

I see that the "controls" in general is only a true/false statement, but i am looking for a way to disable the fullscreen option from the video.

I could do controls false and use autoplay the video - Then i have no controls - and the video will just play.. - but i think this is too drastic a "solution".

So what kind of solution can be done to achieve what i am looking for ?

like image 415
Niels Avatar asked May 23 '13 14:05

Niels


People also ask

How do I disable video in HTML?

To disable video autoplay, autoplay="false" will not work; the video will autoplay if the attribute is there in the <video> tag at all. To remove autoplay, the attribute needs to be removed altogether.

Why video is not playing in HTML5?

An 'HTML5: Video file not found' error indicates either the browser you are using doesn't support HTML5 or the webpage doesn't have the proper video codec. You may contact the website's developer to install HTML5 supporting codecs for all the three WebM, MP4, and OGG formats.


Video Answer


1 Answers

For browsers that incorporate a shadow DOM (e.g. newest version of Chrome), you can still use the default controls, but hide the fullscreen button.

Just be sure to include the following in your CSS:

video::-webkit-media-controls-fullscreen-button
{
        display: none !important;
}

As shadow DOM manipulation like this becomes more commonplace, more browsers will hopefully support it. Until then, stick to making custom controls or putting the video within an iframe as long as your src points to an html file with a video tag in it, and you specify allowfullscreen="false"for the iframe.

like image 152
S. Moulton Avatar answered Sep 17 '22 20:09

S. Moulton