Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

help me with multi jplayer

Posted on 2014-01-06
3
377 Views
Last Modified: 2014-02-14
i have a code with 3 jplayer(see attachment) but when make it dynamic it cant play
need someone help me,
thank you
jplayer.php
0
Comment
Question by:tytdimhen
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39761891
Try this :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>THREE PLAYERS</title>        
<link href="http://jplayer.org/css/jPlayer.css" rel="stylesheet" type="text/css" />        
<link href="http://jplayer.org/latest/skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" type="text/css" />       
<link href="http://jplayer.org/latest/skin/circle.skin/circle.player.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>    
<script type="text/javascript" src="http://jplayer.org/2.1.0/js/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="http://jplayer.org/latest/js/jquery.transform2d.js"></script>
<script type="text/javascript" src="http://jplayer.org/latest/js/jquery.grab.js"></script>
<script type="text/javascript" src="http://jplayer.org/latest/js/mod.csstransforms.min.js"></script>
<script type="text/javascript" src="http://jplayer.org/latest/js/circle.player.js"></script>       
<script>
	jQuery(function($) {

		var mp3links = ['http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3', 'http://kolber.github.io/audiojs/demos/mp3/juicy.mp3', 'http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3'];

		var nb_players = $(".jp-jplayer").length;
		var nb_MP3s = mp3links.length;
		var i = 0;

		function createPlayer() {
			var mp3link = mp3links[i];
			$("#jquery_jplayer_"+i).jPlayer({
				ready: function() {
					$(this).jPlayer("setMedia", { mp3: mp3link });
					i++;
					if(i<nb_players && i<nb_MP3s) {
						createPlayer();
					}
				},
				play: function() { // To avoid both jPlayers playing together.
					$(this).jPlayer("pauseOthers");
				},
				supplied: "mp3",
				cssSelectorAncestor: "#jp_container_"+i
			});
		}

		createPlayer();

	});
</script>
</head>
<body>
<?php
for($i=0;$i<3;$i++){
?>
    <div id="jquery_jplayer_<?php echo $i?>" class="jp-jplayer"></div>
    <div class="jp-audio" id="jp_container_<?php echo $i?>">
        <div class="jp-type-single">
            <div class="jp-gui jp-interface">
                <ul class="jp-controls">
                    <li><a tabindex="1" class="jp-play" href="javascript:;" style="display: block;">play</a></li>
                    <li><a tabindex="1" class="jp-pause" href="javascript:;" style="display: none;">pause</a></li>
                    <li><a tabindex="1" class="jp-stop" href="javascript:;">stop</a></li>
                    <li><a title="unmute" tabindex="1" class="jp-unmute" href="javascript:;" style="display: none;">unmute</a></li>
                </ul>
                <div class="jp-progress">
                    <div class="jp-seek-bar" style="width: 100%;">
                        <div class="jp-play-bar" style="width: 0%;"></div>
                    </div>
                </div>
            </div>
            <div class="jp-no-solution" style="display: none;"></div>
    	</div>
    </div>	
<?php
}
?>
</body>
</html>

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question