代码如下,能播放,但点击停止后就不能在播放了。望高手指教
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Demo : jPlayer as an audio player</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script> <script type="text/javascript" src="js/jquery.jplayer.min.js"></script> <script type="text/javascript"> var player = { startPlayer: function () { $("#jquery_jplayer").jPlayer({ ready: function () { $(this).jPlayer("setMedia", { wav: "file/Ringin.wav" }).jPlayer("play"); }, ended: function (event) { $(this).jPlayer("play"); }, swfPath: "js", supplied: "wav" }); }, stopPlayer: function () { $("#jquery_jplayer").jPlayer("stop"); } }; </script> </head> <body> <div id="jquery_jplayer"></div> <input id="btnStart" type="button" class="jp-play" value="开始" onclick="player.startPlayer()" /> <input id="btnEnd" type="button" class="jp-stop" value="结束" onclick="player.stopPlayer()" /> </body> </html>
重新注册
$("#jquery_jplayer").jPlayer({ ready: function () { $(this).jPlayer("setMedia", { wav: "file/Ringin.wav" }).jPlayer("play"); }, ended: function (event) { $(this).jPlayer("play"); }, swfPath: "js", supplied: "wav" });
就能关闭啦