APlayer
APlayer copied to clipboard
Is there an API to get information about the currently playing audio?如何获取当前正在播放的音频的信息?
trafficstars
English:
Song title, artist, lyrics, and other attribute values in the audio array object? For example: Suppose there is a button on the page, when I click the button, I can get the current playing information through this API.
中文
如何获取当前正在播放的音频的信息?标题、艺人、歌词、以及audio数组对象里的其他信息? 例如:假设页面上有一个按钮,当我点击这个按钮时,获取当前播放的信息。
自问自答,偶然间发现的
const ap = new APlayer(options);
ap.on('play', function (e) {
console.log(e);
console.log(ap.list.audios[ap.list.index]);
});