How to hide the Download button and video button of the video Element

Source: Internet
Author: User

How to hide the Download button and video button of the video Element

1. Use the ControlList API of the video Element

<video controls controlsList="nodownload"></video>

Through the ControList API, you can not only hide the Download button by setting nodownload, but also set nofullscreen to hide full screen buttons and noremoteplayback and other attributes. For specific examples, refer to github pages. This solution has the advantages of native support, does not produce bugs, and is easy to set up. However, since the ControlList API was introduced from Chrome 58 +, therefore, Chrome versions earlier than 58 can only be hidden through method 2.

 

2. Hide with CSS

After you enable the shadow DOM switch through Settings | Preferences-> Elements-> Show user agent shadow DOM, you can view the components of the video element through devtools.

The download button is displayed through <input type = "button" pseudo DO = "-internal-media-controls-download-button" style = "">, you can use the following CSS to hide it:

video::-internal-media-controls-download-button {    display: none;}

 

However, it is a pity that this method does not work. It may be a BUG in Chrome, so we can only find another way. Simply put, we can squeeze the Download button out of the visible range, in this way, you can think that the button is hidden in disguise. The Code is as follows:

video::-webkit-media-controls {    overflow: hidden !important;}video::-webkit-media-controls-enclosure {    width: calc(100% + 32px);    margin-left: auto;}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.