DIYgod / APlayer

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

建议添加Chrome的MediaSession全局媒体控件样式的支持 #792

Open ktech0 opened 7 months ago

ktech0 commented 7 months ago

swappy-20240404_201503

track23 commented 7 months ago

播放器的on事件自己处理一下吧,项目好像不更新了。

 ap.on('play', () => {
      const currentPlayMeta = ap.list.audios[ap.list.index]
      navigator.mediaSession.metadata = new MediaMetadata({
        title: currentPlayMeta.name,
        artist: currentPlayMeta.artist,
        album: currentPlayMeta.artist,
        artwork: [{ src: currentPlayMeta.cover || '' }]
      })
    })