If there is anyone who used jplayer before, I need help with this question.
I have several jplayers where each player has to play his own audio file. But this is not so, if I play jplayer, then all jplayers play, all play the same audio file from the selected jplayers. In fact, if I use the control in one jplayer, it also controls all the other jplayers.
So, I'm trying to implement jplayers from multiple instances, the information from which comes from this:
http://www.jplayer.org/latest/demo-03/
But I'm really trying to implement this, so my question is: can someone help me finish the implementation for this, so that jplayers work as they should, and jplayer just controls only its player and does not affect other jplayers
Below is the javascript code that I have at the moment (view source):
<script type="text/javascript"> $(document).ready(function(){ $("#jquery_jplayer_1-72-0").jPlayer({ ready: function () { $(this).jPlayer("setMedia", { mp3: "AudioFiles/Kalimba.mp3" }); }, play: function() { </script>
UPDATE:
Actual code:
If there is no audio file, display another space for each audio file, display the audio player. I also included html controls, not sure if needed, but posted it just in case
//start:procedure audio $aud_result = ''; if(empty($arrAudioFile[$key])){ $aud_result = ' '; }else{ $j = 0; foreach ($arrAudioFile[$key] as $a) { $info = pathinfo('AudioFiles/'.$a); ?> <script type="text/javascript"> $(document).ready(function(){ $("#jquery_jplayer_1-<?php echo $key.'-'.$j; ?>").jPlayer({ ready: function () { $(this).jPlayer("setMedia", { <?php echo $info['extension'];?>: "<?php echo "AudioFiles/".$a; ?>" }); $(this).bind($.jPlayer.event.play, function() { $(this).jPlayer("pauseOthers"); }); }, solution:"flash,html", swfPath: "jquery", supplied: "<?php echo $info['extension'];?>" }); }); </script> <div id="jquery_jplayer_1-<?php echo $key.'-'.$j; ?>" class="jp-jplayer"></div> <div id="jp_container_1" class="jp-audio"> <div class="jp-type-single"> <div class="jp-gui jp-interface"> <ul class="jp-controls"> <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li> <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li> <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li> <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li> <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li> <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li> </ul> <div class="jp-progress"> <div class="jp-seek-bar"> <div class="jp-play-bar"></div> </div> </div> <div class="jp-volume-bar"> <div class="jp-volume-bar-value"></div> </div> <div class="jp-time-holder"> <div class="jp-current-time"></div> <div class="jp-duration"></div> <ul class="jp-toggles"> <li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li> <li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li> </ul> </div> </div> </div> </div> <?php $j++; } }