我正在创建一个具有自定义播放和音量控制的音频播放器。我创建了一个静音切换和音量滑块,可以在Chrome中正常工作但在Firefox中无效。我看到THIS链接,看起来这可能是一个有待解决的问题。
HTML:
<audio id="audio" style="width:800px;">
<source src="video/NMGTT.mp3" type="audio/mp3">
</audio>
<div id="media-controls">
<button type="button" id="play-pause" class="paused" >PLAY/PAUSE</button>
<button type="button" id="rewind10" >REWIND 10 SECONDS</button>
<button type="button" id="loop" >LOOP</button>
<input id="seekslider" type="range" min="0" max="100" value="0">
<span id="curtimetext">00:00</span> / <span id="durtimetext">00:00</span>
<div id="fullVolume">
<button id="mutebtn" >MUTE</button>
<div id="volumeContainer"><input id="volumeslider" type="range" min="0" max="100" value="100" step="1" class="vertical" orient="vertical"></div>
</div>
</div>
JS:
var track = document.getElementById('audio');
mutebtn = document.getElementById("mutebtn");
mutebtn.addEventListener("click",vidmute);
function vidmute(){
if(track.muted){
track.muted = false;
} else {
track.muted = true;
}
}
提醒:此问题仅在FIREFOX中。