Embed APlayer(https://github.com/DIYgod/APlayer) in Hexo posts/pages.
npm install --save hexo-tag-aplayer
{% aplayer title author url [picture_url, narrow, autoplay, width:xxx, lrc:xxx] %}
title
: music titleauthor
: music authorurl
: music file urlpicture_url
: optional, music picture urlnarrow
: optional, narrow styleautoplay
: optional, autoplay music, not supported by mobile browserswidth:xxx
: optional, prefixwidth:
, player's width (default: 100%)lrc:xxx
: optional, prefixlrc:
, LRC file url
With post asset folders enabled, you can easily place your image, music and LRC file into asset folder, and reference them like:
{% aplayer "Caffeine" "Jeff Williams" "caffeine.mp3" "picture.jpg" "lrc:caffeine.txt" %}
Besides 'lrc' option, you can use aplayerlrc
which has end tag to show lyrics.
{% aplayerlrc "title" "author" "url" "autoplay" %}
[00:00.00]lrc here
{% endaplayerlrc %}
Hexo has an issue that cannot use space within tag arguments.
If you encounter this problem, install the latest (beta) version, and wrap the arguments within a string literal, for example:
{% aplayer "Caffeine" "Jeff Williams" "caffeine.mp3" "autoplay" "width:70%" "lrc:caffeine.txt" %}
You can modify variables scriptDir
(default: "/assets/js/" ) in index.js
according to your blog's directory structure.
MIT