如何使用JavaScript

时间:2018-06-22 10:10:40

标签: javascript php mysql

这是我的简单播放器,音频文件的链接正在从数据库中拉出(我将音乐文件名存储在数据库中),它只播放一首歌曲,我如何告诉它继续播放呢?前十首歌?这是我的代码:

<?php
$sql = "SELECT * FROM songs ORDER BY id ASC LIMIT 2,1;";
$result = mysqli_query($con, $sql);
$resultCheck = mysqli_num_rows($result);

if ($resultCheck > 0) {
while ($row = mysqli_fetch_assoc($result)) {
?>

<div class="col-md-4 player">
<div class="audio-player">
<audio id="audio-player"  controls="controls">
<source src="media/audio/<?php echo $row['audio_file']; ?>" 
type="audio/mpeg"></source>
</audio>
</div>
<?php
}
}
?>

这是我的JavaScript

<script type="text/javascript">
$(function(){
$('#audio-player').mediaelementplayer({
alwaysShowControls: true,
    features: ['playpause','progress','volume'],
    audioVolume: 'horizontal',
    iPadUseNativeControls: true,
    iPhoneUseNativeControls: true,
    AndroidUseNativeControls: true
  });
});

0 个答案:

没有答案