audio player support m3u8/mp3
- initialize CRadio
var radio = new CRadio('.voice-wrapper', {
continuous: true,
loop: false,
controls: {
playBtn: '.voice-btn-play',
prevBtn: '.voice-btn-prev',
nextBtn: '.voice-btn-next',
muteBtn: '.voice-btn-mute',
totalTime: '.voice-time-total',
currentTime: '.voice-time-current',
volumeProgress: '.voice-volume-progress',
audioProgress: '.voice-audio-progress',
},
watchState: function(state) {
console.log(state)
}
})
- load playlist
radio.load([
"title": "audio title",
"url": "audio url",
"live": true/false
])
- add playlist
radio.append({
"title": "audio title",
"url": "audio url",
"live": true/false
})
or
radio.append([
{
"title": "audio title1",
"url": "audio url1",
"live": true/false
},
{
"title": "audio title2",
"url": "audio url2",
"live": true/false
}
])
- reset CRadio
radio.destroy()
- reload CRadio
radio.reload([
{
"title": "audio title1",
"url": "audio url1",
"live": true/false
},
{
"title": "audio title2",
"url": "audio url2",
"live": true/false
}
])