douman6245 2018-06-22 10:10
浏览 41

如何使用JavaScript在mysql数据库上播放多个音频文件

this is my simple player here of which the link of the audio file is being pulled from the database (i store the music file name on the database), it plays only one song how can i tell it to continue playing let say 10 first songs ? here is my code:

<?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
}
}
?>

here is my javascript

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题