DIYgod / APlayer

:lollipop: Wow, such a beautiful HTML5 music player
http://aplayer.js.org
MIT License
7.33k stars 1.03k forks source link

dynamic update lyric. 动态更新歌词 #790

Open jsbxyyx opened 9 months ago

jsbxyyx commented 9 months ago

中文用户请注意:请尽量用英文描述你的 issue,这样能够让尽可能多的人帮到你。

If you want to report a bug, please provide the following information:

jsbxyyx commented 9 months ago
function updateLyric(lyric) {
  var index = window.ap.list.index;
  window.ap.lrc.parsed[index] = window.ap.lrc.parse(lyric);
  var html = '';
  for (var idx in window.ap.lrc.parsed[index]) {
    var value = window.ap.lrc.parsed[index][idx];
    if (idx == 0) {
      html += '<p class="aplayer-lrc-current">' + value[1] + '</p>';
    } else {
      html += '<p>' + value[1] + '</p>';
    }
  }
  window.ap.lrc.container.innerHTML = html;
  window.ap.lrc.update(0);
  window.ap.lrc.current = window.ap.lrc.parsed[index];
}
Denghongjian233 commented 6 months ago
function updateLyric(lyric) {
  var index = window.ap.list.index;
  window.ap.lrc.parsed[index] = window.ap.lrc.parse(lyric);
  var html = '';
  for (var idx in window.ap.lrc.parsed[index]) {
    var value = window.ap.lrc.parsed[index][idx];
    if (idx == 0) {
      html += '<p class="aplayer-lrc-current">' + value[1] + '</p>';
    } else {
      html += '<p>' + value[1] + '</p>';
    }
  }
  window.ap.lrc.container.innerHTML = html;
  window.ap.lrc.update(0);
  window.ap.lrc.current = window.ap.lrc.parsed[index];
}

what is this. dont get it