Skip to content

Latest commit

 

History

History
71 lines (70 loc) · 1.21 KB

README.md

File metadata and controls

71 lines (70 loc) · 1.21 KB

CRadio

audio player support m3u8/mp3

usage

  • 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
  }
])