我将其用于在线广播电台,我不需要播放/暂停按钮或时间线...
但我确实需要音量和静音按钮,是否可以制作我自己的按钮并将它们链接到默认音频元素?
最佳答案
<audio>
元素从 HTMLMediaElement
继承属性
如 W3C 所述,要更改这些,只需为它们分配新值即可:
On setting, if the new value is in the range 0.0 to 1.0 inclusive, the attribute must be set to the new value and the playback volume must be correspondingly adjusted as soon as possible after setting the attribute
我建议您设计自己的 html 按钮并将这些按钮分配给函数以控制诸如音量之类的属性。我做了一点demo带有 slider 和静音复选框。
关于html - 自定义 <audio> 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31683537/