我正在尝试创建一个jplayer流式音频播放器,但遇到了播放器不会“暂停”音频的问题。播放器将停止并启动音频,但我希望将音频暂停在流的当前位置,并在再次按下播放时恢复音频。
感谢任何帮助!
这是我的代码
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
var stream = {
title: "",
mp3:""
},
ready = false;
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
ready = true;
$(this).jPlayer("setMedia", stream);
},
pause: function() {
$(this).jPlayer("clearMedia");
},
error: function(event) {
if(ready && event.jPlayer.error.type ===
$.jPlayer.error.URL_NOT_SET) {
// Setup the media stream again and play it.
$(this).jPlayer("setMedia", stream).jPlayer("play");
}
},
swfPath: "dist/jplayer",
supplied: "mp3",
preload: "none",
wmode: "window",
useStateClassSkin: true,
autoBlur: false,
keyEnabled: true
});
});
//]]>
</script>
<style type="text/css">
.auto-style1 {
text-align: center;
}
</style>
</head>
<body>
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
</div>
<div class="jp-controls-holder">
<div class="auto-style1">
<form>
<input name="image" type="image" src="play100.png" class="jp-play" tabindex="0" <?=$dis?>
<input name="image" type="image" src="pause100.png" class="jp-pause" <?=$dis?>
<input name="image" type="image" src="stop100.png" class="jp-stop" <?=$dis?>
</form>
</div>
</div>
</div>
</div>
<div class="jp-no-solution">
</div>
</div>