How to USE <embed> tag for music player control?

南笙酒味 提交于 2019-12-25 01:49:57

问题


I'm using HTML tag to control my mp3 file. I learnt 2 method from Start and stop for a embeded music in html using javascript works only in IE

function play() {
    document.embeds[0].play();
}
function stop() {
    document.embeds[0].stop();
}

and my js code is like below:

 <body>
    <embed height="50" width="100"  src="demo.mp3" AutoStart="false"  loop="true">
   <script type="text/javascript">
    function play() {
        document.embeds[0].play();
    }
    function stop() {
        document.embeds[0].stop();
    }
    function pause() {
        document.embeds[0].pause();        
    }

    function forward() {
       //how?
    }

    function rewind() {
       //how?
    }
    function volumeup() {
       //how to add volume?
    }
    function volumedown() {
       //how to turn down?
    }
</script> 
</body> 

and,the problem is obvious that i still coundnot find out the method or function of embed to control mp3 player after looong searching.

And I have tried audio tag,however in my ie9(and 10 also) it still cannot work well,it trun out to be a black box with red error symbol.

So,can anyone give me some advice?thx.

来源:https://stackoverflow.com/questions/16085047/how-to-use-embed-tag-for-music-player-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!