您好,感谢您提供的任何帮助。我是网络开发的新手。我意识到这看起来非常糟糕,但是我想在我设计它之前获得功能。 PHP一直是一场噩梦。
我正在从一个mysql数据库中提取一系列歌曲,这些数据应该被放入一个jplayer播放列表中。我为我的生活无法理解为什么我一直收到这个错误:jplayer.php:未捕获的ReferenceError:未定义jPlayerPlaylist。我需要帮助调试这个,请记住我是全新的...我知道我是一个可怕的程序员。
<?
$localhost='127.0.0.1';
$username='root';
$password='';
$database='radio';
$link = mysqli_connect($localhost, $username, $password, $database);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Radio Station </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"> </script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="js/jquery.jplayer.js"></script>
<link type="text/css" href="skin/pink.flag/css/jplayer.pink.flag.min.css" rel="stylesheet" />
</head>
<body>
<header>
<ul>
<li><a href="#.php">Noonish Nineties</a></li>
<li><a href="#.php">Late Afternoon Indie</a></li>
<li><a href="#.php">Late With Nocturnal</a></li>
</ul>
</header>
<section id="container">
<style>
#container
{
position: relative;
width: 95%;
padding-top: 150px;
padding-left: 100px;
padding-right: 10px;
margin: 15 auto;
font-family: Sans-Serif;
font-size: 120%;
border: 5px solid gray;
background-color: white;
}
</style>
<?php
$localhost='127.0.0.1';
$username='root';
$password='';
$database='radio';
$link = mysqli_connect($localhost, $username, $password, $database);
$baseurl = "music/";
$sql2 = "SELECT GROUP_CONCAT(url) as path FROM track WHERE trackid IN
(SELECT pt.trackid from playlisttrack pt, track t, playlist p WHERE t.trackid = pt.trackid
AND pt.playlistid = p.playlistid AND p.playlistid = 60002)";
if($s2_query = mysqli_query($link,$sql2))
{
while ($row = $s2_query->fetch_assoc())
{
$playlist = "[" . "'" . $row['path'] . "'" . "]";
}
}
?>
<script type="text/javascript">
$(document).ready(function(){
var playlist = <?php echo $playlist;?>;
var myPlaylist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_N",
cssSelectorAncestor: "#jp_container_N"
}, playlist, {
playlistOptions: {
enableRemoveControls: true
},
swfPath: "/js",
supplied: "ogv, m4v, oga, mp3",
smoothPlayBar: true,
keyEnabled: true,
audioFullScreen: false // Allows the audio poster to go full screen via keyboard
});
//var cssSelector = { jPlayer: "#playlist_1", cssSelectorAncestor: "#playlist_container" };
//var options = { swfPath: "/js", supplied: "mp3", smoothPlayBar: true, autoPlay: true, keyEnabled: true, shuffleOnLoop: true, wmode: "window" };
//var myPlaylist = new jPlayerPlaylist(cssSelector, playlist, options);
});
</script>
<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 class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria- label="time"> </div>
<div class="jp-duration" role="timer" aria- label="duration"> </div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
</div>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title"> </div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>
<br>
<br>
<br>
<br>
<br>
</section>
<?php
mysqli_close($link);
?>
</body>
谢谢。
答案 0 :(得分:1)
jPlayerPlaylist是jplayer的附加组件,默认情况下不包含它,所以你必须先包含它,你可以在dist / add-on文件夹中找到它