DIYgod / APlayer

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

How to get current song meta data? #700

Open yduke opened 3 years ago

yduke commented 3 years ago

After read the documents, didn't find how to get song info in javascript way.

should be something like:

ap.getCurrentSong.title ap.getPlaying.album

Is there any way in js to get informations of current playing song metadatas?

edward852 commented 3 years ago

个人观点:ap.list.index和ap.list.audios可以拿到当前歌曲,album应该要用其他库解析得到元数据

yduke commented 3 years ago

Find the solution now: Thanks to @edward852 找到解决方法了:谢谢 @edward852

first you have to get the number of current song like @edward852 said: 首先你需要得到当前歌曲的编号,就像 @edward852 说的一样:

var ind=ap.list.index

Then we can use this number to determin which song we wanna grab: 然后你就可以用这个编号来决定是哪一首的信息我们需要获得:

Song name: 歌名: ap.options.audio[ind].name Artist: 艺术家: ap.options.audio[ind].artist

Album: 专辑: ap.options.audio[ind].album

ojhdt commented 2 years ago

It helps me a lot, thank you! @yduke