npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vitepress-plugin-awesome-musicplayer

v1.0.4

Published

a music player by vitepress

Downloads

19

Readme

vitepress-plugin-awesome-musicplayer

一款基于vitepress插件的音乐播放器,打破以往博客音乐播放方式,让用户有更佳的沉浸式体验。 该插件是vitepress的适配,原版为 vuepress 1.x ,传送门: vuepress-plugin-awesome-musicplayers

说明

该插件参考了vue-netease-music,把Mac端的网易云播放器界面的部分功能做成了vitepress插件,让用户在vitepress里也有同样的音乐体验,接口来自 保罗API

安装

npm install vitepress-plugin-awesome-musicplayer -D

使用

配置

.vitepress/theme/config.js 下增加插件配置

import DefaultTheme from 'vitepress/theme'
import MusicPlayer from 'vitepress-plugin-awesome-musicplayer'

export default {
  ...DefaultTheme,
  enhanceApp({ app }) {
    app.component('MusicPlayer', MusicPlayer)
  }
}

获取歌曲id

目前通过获取网易云的歌曲id来进行播放,id获取方式如下:

  1. 打开网易云客户端,播放一首音乐
  2. 点击分享按钮,选择复制链接
  3. 链接格式如:https://music.163.com/song?id=xxx&userid=xxx 就是该歌曲的id
  4. 由于接口原因,可能有的音乐无法读取,多次刷新可能造成请求失败

获取音源

为了更好的用户体验,增加了音频解析可视化面板,由于三方接口配合 MediaElementAudioSourceNode 会导致 CORSCORB 播放报错,所以需要手动添加音源文件链接,建议使用类似图床链接引入即可。

引入

在想要插入播放器的Markdown页面,加入以下代码即可:

<MusicPlayer musicId="xxx" musicSrc="xxx.mp3" style="margin:0 auto" />

主题

如果想改变主题,添加 theme 参数即可,默认是 apple 主题:

<MusicPlayer theme="apple">

默认提供了:appleauroraborealiscandycoolduskoutrunsummertiedyerainbow 10种渐变色。

也可以自定义颜色,传入一个渐变色类型参数即可,格式如下:

<MusicPlayer :theme="[{pos: 0, color: '#000'},{pos: 0.4, color: '#aaa'}, {pos: 1, color: '#fff'}]">

其中 pos 代表初始颜色位置的百分比(从0到1),color 代表颜色。

效果图