0
3つのラジオボタンでJPlayerの1つのインスタンスを制御しようとしているので、チェックされていないストリームの再生が停止している間に1つのボタンが再生されます。 ページが読み込まれたときに、最初のストリームが再生を開始していますが、他の2つのボタンのいずれかをチェックすると、最初のストリームは変更されません。何が問題なの?ラジオボタンの付いたJPlayerストリーム
私のコードは以下の通りです:
<script>
$(document).ready(function(){
if(document.getElementById('blue').checked) {
//Blue radio button is checked
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
mp3:"http://s6.voscast.com:10522/;stream/1"
}).jPlayer("play"); // Attempts to Auto-Play the media;
},
play: function() { // To avoid both jPlayers playing together.
$(this).jPlayer("pauseOthers");
},
swfPath: "js",
supplied: "mp3",
wmode: "window",
smoothPlayBar: true,
keyEnabled: true
});
}else if(document.getElementById('orange').checked) {
//Orange radio button is checked
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
mp3:"http://stream.tilos.hu/tilos_32.mp3"
}).jPlayer("play"); // Attempts to Auto-Play the media;
},
play: function() { // To avoid both jPlayers playing together.
$(this).jPlayer("pauseOthers");
},
swfPath: "js",
supplied: "mp3",
wmode: "window",
smoothPlayBar: true,
keyEnabled: true
});
}else if(document.getElementById('purple').checked) {
//Purple radio button is checked
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
mp3:"http://mr-stream.mediaconnect.hu/4738/mr2.mp3"
}).jPlayer("play"); // Attempts to Auto-Play the media;
},
play: function() { // To avoid both jPlayers playing together.
$(this).jPlayer("pauseOthers");
},
swfPath: "js",
supplied: "mp3",
wmode: "window",
smoothPlayBar: true,
keyEnabled: true
});
}
});
</script>
これらはボタンです:
<div id="radiobox">
<div class="cc-selector">
<input checked="checked" id="blue" type="radio" name="rtype" value="blue" />
<label class="radio-cc blue" for="blue"></label>
<input id="orange" type="radio" name="rtype" value="orange" />
<label class="radio-cc orange"for="orange"></label>
<input id="purple" type="radio" name="rtype" value="purple" />
<label class="radio-cc purple"for="purple"></label>
</div>
</div>
そして、ここでは、プレイヤーである:
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio-stream">
<div class="label"></div>
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1" id="playBtn"></a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1"id="stopBtn"></a></li>
</ul>
</div>
</div>
</div>
おかげで、私の問題を解決してたくさん!私はまだ多くのことを学ぶ必要があります:) –