HTML5 inserting audio

Source: Internet
Author: User

<body>
<audio controls= "controls" >
<source src= "Lam ゆうき-lost Case.mp3" ></source>
<source src= "Lam ゆうき-lost Case.mav" ></source>
</audio>
<input type= "range" min= "0" max= "1" step= "0.2" value= "0.2"/>
<progress max= "value=" 0 "></progress>
<button id= "bo" > Play </button>
<button id= "ting" > Pause </button>
<button id= "lod" > Reload </button>
<button id= "Jin" > Fast forward </button>
<button id= "tui" > Rewind </button>
<button id= "Jia" >+</button>
<button id= "Jian" >-</button>
<button id= "jing" > Mute </button>
</body>
<script>
var au=document.queryselector ("audio")
var jin=document.queryselector ("#jin");
var tiu=document.queryselector ("#tui");
var bo=document.queryselector ("#bo");
var ting=document.queryselector ("#ting");
var lod=document.queryselector ("#lod");
var jia=document.queryselector ("#jia");
var jian=document.queryselector ("#jian");
var jing=document.queryselector ("#jing");
Bo.onclick=function () {
Au.play ();
SetInterval (function () {
var x=au.duration/100;
var pro=document.queryselector ("Progress"). Value+=1
},1000)
One button to play and pause
if (au.paused==true) {
Bo.innerhtml= "Pause";
Au.play ();
// }
else{
Bo.innerhtml= "Play";
Au.pause ();
// }
}
Ting.onclick=function () {
Au.pause ();
}
Lod.onclick=function () {
Au.load ();
}
Jin.onclick=function () {
au.currenttime+=10;
Console.log (Au.currenttime)
}
Tui.onclick=function () {
au.currenttime-=10;
Console.log (Au.currenttime)
}
au.volume=0;
Jia.onclick=function () {
au.volume+=0.1;
}
Jian.onclick=function () {
au.volume-=0.1;
}
Jing.onclick=function () {
au.volume=0;
}
var inp=document.queryselector ("input");
Inp.onchange=function () {
var au=document.queryselector ("audio");
Au.volume=inp.value;
}
</script>

HTML5 inserting audio

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.