简体   繁体   中英

Remove mute/volume bar from standard Html5 audio player?

Given the standard html5 audio player,

HTML:

<audio controls></audio>

( Picture )

Is there a way to remove only the "mute" button and volume slider? I'd like to keep the play/pause button and the track-position slider.

To change these you can use some crafty CSS . With the border radius altered on the right hand side this looks like what you are after.

在此处输入图片说明

See this js fiddle http://jsfiddle.net/3j76551r/1/

 div {
    width: 260px;
    overflow: hidden;
    direction: ltl;
    border-top-right-radius: 0.5em 0.5em;
    border-bottom-right-radius: 1em 0.7em;
}

Another option would be the javascript option. This would be to write your own player using the html audio element. There is a really good tutorial here that I have done in the past that teaches you how to write your own player with javascript.

I found a way to solve this by manipulating the css, specific to the audio tag. This way, you can remove and modify elements related to the controls container. Please have a look here for further details: https://stackoverflow.com/a/64012853/13334628

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