简体   繁体   English

自定义html5音频播放器

[英]Custom html5 audio player

I found out that there is a new HTML5 tag. 我发现有一个新的HTML5标签。 I want a HTML/Javascript code but I dont want any jQuery in it. 我想要HTML / Javascript代码,但我不想要任何jQuery。 Its for a html doc which will have music playing automaticaly in the background, i would like the code to make a little mute button in the topleft corner of the screen. 对于html文档,它将在后台自动播放音乐,我希望代码在屏幕的左上角做一个小的静音按钮。 Heres the standard code to work on. 这是要处理的标准代码。

<audio controls="?"* loop="loop">
  <source src="horse.wav" type="audio/wave">
</audio>

*: Not sure if to be included *:不确定是否要包含在内

The button may be text or picture and it may change (eg: mute/unmute or mute then when clicked changes to unmute and back). 该按钮可以是文本或图片,并且可以更改(例如:静音/取消静音或静音,然后单击时更改为取消静音和返回)。

This should work : 应该工作

document.getElementById('background_audio').muted = true;

Demo: http://jsfiddle.net/mattball/sVwXH/ (no jQuery) 演示: http : //jsfiddle.net/mattball/sVwXH/ (无jQuery)

Reference 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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