简体   繁体   中英

Disabling fullscreen button on HTML5 video tag

When googling for 'disable HTML5 video fullscreen' most of the answers suggest that I disable custom controls of the <video> tag and build myself custom ones but right there on the MDN site, there's an article on <video> tag with all the examples having disabled just that one button (enter full screen mode):https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video . My question is: how is it done?

I don't know how your exemple works, but you can try this

<video controls controlslist="nofullscreen">
  <source src="video.mp4" type="video/mp4">
</video>

The controlslist attribute, when specified, helps the browser select what controls to show on the media element whenever the browser shows its own set of controls (eg when the controls attribute is specified). The allowed values are nodownload, nofullscreen and noremoteplayback.

<video controls controlsList="nofullscreen">

https://googlechrome.github.io/samples/media/controlslist.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM