随意播放 HTML5 音频
要随机播放,这样添加歌曲 −
init ([ 'http://demo.com/songs/song1.mp3, 'http://demo.com/songs/song2.mp3, 'http://demo.com/songs/song3.mp3 ]);
使用以下内容通过 Math.random − 随机播放
function displayRandom() {
var audio = Math.floor(Math.random() * (collection.length));
audio = collection[audio];
audio.play();
setTimeout(loop,audio.duration*1000);
}
广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP