Mercurial > hg > Members > e075723
view resources/music.js @ 2:3fe0d4829300
test
author | Yui SHIMURA <e075723@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 30 Nov 2010 17:43:13 +0900 |
parents | |
children |
line wrap: on
line source
/**音を鳴らす為の関数**/ //usage //var sample = MusicLoad("./sound/sample.wav"); //BgmPlay(sample,"on"); //---------------------------------------------- //MusicLoad load a music file //BgmPlay play music with loop //SoundPlay play sound onetime // prototype //readonly attribute MediaError error; //void play(); //void pause(); //interface HTMLAudioElement : HTMLMediaElement {}; //Audio //attribute DOMString src; //attribute DOMString preload; //attribute boolean autoplay; //attribute boolean loop; //attribute boolean controls; function MusicLoad(src) { var audio =new Audio(src); return(audio); } function BgmPlay(audio,sta) { if(sta =="on"){ audio.play(); audio.loop=true; }else if( sta =="off" ){ audio.pause(); } } function SoundPlay(audio) { audio.play(); }