All Projects β†’ MoePlayer β†’ Hexo Tag Aplayer

MoePlayer / Hexo Tag Aplayer

Licence: mit
Embed aplayer in Hexo posts/pages

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Hexo Tag Aplayer

Hexo Generator Search
A plugin to generate search data for Hexo.
Stars: ✭ 318 (-42.39%)
Mutual labels:  hexo, plugin
Music Player
From UI Proposal to Code πŸŽΆβ–ΆοΈ
Stars: ✭ 3,459 (+526.63%)
Mutual labels:  music, player
Upnext
Chrome Extension for streaming music from SoundCloud & YouTube
Stars: ✭ 320 (-42.03%)
Mutual labels:  music, player
Feeluown
trying to be a user-friendly and hackable music player
Stars: ✭ 3,030 (+448.91%)
Mutual labels:  music, player
Skplayer
🎡 A simple & beautiful HTML5 music player
Stars: ✭ 437 (-20.83%)
Mutual labels:  music, player
Openwhyd
πŸ’Ž Like Pinterest, for Music
Stars: ✭ 287 (-48.01%)
Mutual labels:  music, player
React Music Player
🎡 Maybe the best beautiful HTML5 responsive player component for react :)
Stars: ✭ 321 (-41.85%)
Mutual labels:  music, player
Sonobus
Source code for SonoBus, a real-time network audio streaming collaboration tool.
Stars: ✭ 586 (+6.16%)
Mutual labels:  plugin, music
Ts3audiobot
Advanced Musicbot for Teamspeak 3
Stars: ✭ 397 (-28.08%)
Mutual labels:  plugin, music
Nakplaybackindicatorview
A UIView that mimics the music playback indicator in the Music.app on iOS 7+
Stars: ✭ 394 (-28.62%)
Mutual labels:  music, player
Hexo Prism Plugin
Hexo plugin for code highlighting by prism.js, supporting JSX syntax
Stars: ✭ 195 (-64.67%)
Mutual labels:  hexo, plugin
Awesome Hexo
A curated list of awesome things related to Hexo
Stars: ✭ 466 (-15.58%)
Mutual labels:  hexo, plugin
Hexo Wordcount
A Word Count Plugin for Hexo
Stars: ✭ 150 (-72.83%)
Mutual labels:  hexo, plugin
Simple Music Player
Simple Music Player - SimpleMP - Keeps it simple and plays your music
Stars: ✭ 298 (-46.01%)
Mutual labels:  music, player
Audiokitsynthone
AudioKit Synth One: Open-Source iOS Synthesizer App
Stars: ✭ 1,258 (+127.9%)
Mutual labels:  plugin, music
Vinylmusicplayer
A material designed music player for Android
Stars: ✭ 323 (-41.49%)
Mutual labels:  music, player
Ytermplayer
Stream youtube playlists as audio on linux terminal
Stars: ✭ 235 (-57.43%)
Mutual labels:  music, player
Pathephone Desktop
Distributed audio player
Stars: ✭ 240 (-56.52%)
Mutual labels:  music, player
Playpauseview
Let the play and pause button transition gracefully
Stars: ✭ 383 (-30.62%)
Mutual labels:  music, player
Romplayer
AudioKit Sample Player (ROM Player) - EXS24, Sound Font, Wave Player
Stars: ✭ 445 (-19.38%)
Mutual labels:  music, player

hexo-tag-aplayer

npm npm

Embed APlayer(https://github.com/DIYgod/APlayer) in Hexo posts/pages.

δΈ­ζ–‡ζ–‡ζ‘£

plugin screenshot

Installation

npm install --save hexo-tag-aplayer

Dependency

  • APlayer.js >= 1.10.0
  • Meting.js >= 1.2.0

Usage

{% aplayer title author url [picture_url, narrow, autoplay, width:xxx, lrc:xxx] %}

Option

  • title : music title
  • author: music author
  • url: music file url
  • picture_url: optional, music picture url
  • narrow: optional, narrow style
  • autoplay: optional, autoplay music, not supported by mobile browsers
  • width:xxx: optional, prefix width:, player's width (default: 100%)
  • lrc:xxx: optional, prefix lrc:, 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" %}

With lyrics

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 %}

With playlist

{% aplayerlist %}
{
    "narrow": false,                          // Optional, narrow style
    "autoplay": true,                         // Optional, autoplay song(s), not supported by mobile browsers
    "mode": "random",                         // Optional, play mode, can be `random` `single` `circulation`(loop) `order`(no loop), default: `circulation`
    "showlrc": 3,                             // Optional, show lrc, can be 1, 2, 3
    "mutex": true,                            // Optional, pause other players when this player playing
    "theme": "#e6d0b2",	                      // Optional, theme color, default: #b7daff
    "preload": "metadata",                    // Optional, the way to load music, can be 'none' 'metadata' 'auto', default: 'auto'
    "listmaxheight": "513px",                 // Optional, max height of play list
    "music": [
        {
            "title": "CoCo",
            "author": "Jeff Williams",
            "url": "caffeine.mp3",
            "pic": "caffeine.jpeg",
            "lrc": "caffeine.txt"
        },
        {
            "title": "をむロニ",
            "author": "ιΉΏδΉƒ",
            "url": "irony.mp3",
            "pic": "irony.jpg"
        }
    ]
}
{% endaplayerlist %}

MeingJS support (new in 3.0)

When you use MetingJS, your blog can play musics from Tencent, Netease, Xiami, Kugou, Baidu and more.

See metowolf/MetingJS and metowolf/Meting in detail.

If you want to use MetingJS in hexo-tag-aplayer, you need enable it in _config.yml

aplayer:
  meting: true

Now you can use {% meting ...%} in your post:

<!-- Simple example (id, server, type)  -->
{% meting "60198" "netease" "playlist" %}

<!-- Advanced example -->
{% meting "60198" "netease" "playlist" "autoplay" "mutex:false" "listmaxheight:340px" "preload:none" "theme:#ad7a86"%}

The {% meting %} options are shown below:

Option Default Description
id required song id / playlist id / album id / search keyword
server required Music platform: netease, tencent, kugou, xiami, baidu
type required song, playlist, album, search, artist
fixed false Enable fixed mode
mini false Enable mini mode
loop all Player loop play, values: 'all', 'one', 'none'
order list Player play order, values: 'list', 'random'
volume 0.7 Default volume, notice that player will remember user setting, default volume will not work after user set volume themselves
lrctype 0 Lyric type
listfolded false Indicate whether list should folded at first
autoplay false Autoplay song(s), not supported by mobile browsers
mutex true Pause other players when this player playing
listmaxheight 340px Max height of play list
preload auto The way to load music, can be none, metadata, auto
storagename metingjs LocalStorage key that store player setting
theme #ad7a86 Theme color

Read section customization to learn how to configure self-host meting api server in hexo-tag-aplayer and other configuration.

PJAX compatible

You need destroy APlayer instances manually when you use PJAX.

$(document).on('pjax:start', function () {
    if (window.aplayers) {
        for (let i = 0; i < window.aplayers.length; i++) {
            window.aplayers[i].destroy();
        }
        window.aplayers = [];
    }
});

Customization (new in 3.0)

You can configure hexo-tag-aplayer in _config.yml:

aplayer:
  script_dir: some/place                        # Script asset path in public directory, default: 'assets/js'
  style_dir: some/place                         # Style asset path in public directory, default: 'assets/css'
  cdn: http://xxx/aplayer.min.js                # External APlayer.js url (CDN)
  style_cdn: http://xxx/aplayer.min.css         # External APlayer.css url (CDN)
  meting: true                                  # Meting support, default: false
  meting_api: http://xxx/api.php                # Meting api url
  meting_cdn: http://xxx/Meing.min.js           # External Meting.js url (CDN)
  asset_inject: true                            # Auto asset injection, default: true
  externalLink: http://xxx/aplayer.min.js       # Deprecated, use 'cdn' instead

Troubleshoot

Space within arguments

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" %}

Duplicate APlayer.JS loading

The plugin hooks filter after_render:html , and it would inject APlayer.js and Meting.js in <head>:

<html>
  <head>
    ...
    <script src="assets/js/aplayer.min.js"></script>
    <script src="assets/js/meting.min.js"></script>
  </head>
  ...
</html>

However, after_render:html is not fired in some cases :

  • Does not work with hexo-renderer-jade
  • after_render:html seems not to get emitted in default settings of hexo server module (hexo server), it means you have to use static serving mode( hexo server -s) instead.

In such cases, the plugin would hookafter_post_render as a fallback, which has a possibility to cause duplicate asset loadings.

If you want to solve this issue definitely, you can disable this auto-injection feature in _config.yml and insert the scripts by yourself:

aplayer:
  asset_inject: false

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].