MUSE is a simple and diligent HTML5 audio player made with β€ :)
δΈζζζ‘£ / Redux build / Old version
Have a look at here.
MUSE is available in npmjs. You can install it by both npm and yarn.
$ yarn add muse-player # using yarn
$ npm install --save-dev muse-player # using npm
$ git clone https://github.com/moefront/muse
$ cd muse
$ yarn install # or: npm install
Click Clone or download
then choose Download ZIP
, or redirect to release page to download a release version.
Firstly, import ./dist/assets/muse-player.js to your own page (Stylesheet has been injected in this Javascript file):
<script type="text/javascript" src="./dist/assets/muse-player.js"></script>
We recommend that you import muse-player.js
from unpkg, where you can get the latest version of MUSE:
<script src="https://unpkg.com/muse-player/dist/assets/muse-player.js" type="text/javascript"></script>
Secondly, use MUSE.render()
method to render player to your page.
PS: If you are migrating from YMPlayer 4 to MUSE, pay attention that the method of using custom tag to render player has been removed. But you can still use
MUSE.render()
orYMPlayer.render()
to render a player:
/**
* use MUSE.render() or YMPlayer.render() to
* render a MUSE Player component on your page.
*
* @param data {Array} Musics' detail
* @param node {Object} HTML element in which new player will be put.
* @param opt {Object} Player options
*
* @return {Object}
*/
MUSE.render([{
title: '',
artist: '',
cover: '',
src: '',
lyric: '',
translation: '' // if you do not need translation, delete this row.
}, {
// ......
}], document.getElementById('player'));
First have muse-json-generator
installed. You can install it from npm. Also you should know the musicβs Netease Cloud Music ID that you want to add.
$ npm install -g muse-json-generator
$ muse 2333666 id1 id2 ...
Then you will find a playlist.json
on your workspace, which contains the details(title, artist, lyric, cover, src, translation) of your target.
For more detail, see https://github.com/moefront/muse-json-generator .
You must have muse-player already installed.
import React from 'react';
import { render } from 'react-dom';
import { MuseDOM as MUSE } from 'muse-player';
const playList = [{
// ...
}];
// MUSE.render() will returns a object with React Component and Player ID wrapped
// player { component: ReactComponent, ref: undefined, id }
const player = MUSE.render(playList);
const node = document.getElementById('app'); // DOM
render(
<player.component />,
node
);
require(['muse-player'], function(MuseDOM) {
MuseDOM.render(...);
});
<script text="text/javascript" src="./dist/assets/muse-player.js"></script>
This will export MuseDOM instance to window
:
window.MuseDOM.render();
yarn serve
yarn serve:dist
yarn dist
Projects related to MUSE below can help you construct MUSE Player on your site easily. Thanks for their hard working!
You can find solutions of most problems on Wiki. If not, please open an issue whenever you are facing a problem, or contact us at kirainmoe@gmail.com.
Both contributing code to this project and telling us your suggestion and ideas are welcomed.
Thanks those who contributed to MUSE Player: @kokororin, @frank-deng.
You can find a detailed documentation about APIs, methods, specification, etc. on WiKi.
![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|
IE 10+ β | Chrome 24.0+ β | Firefox 24.0+ β | Opera 15.0+ β | Safari 7.0+ β |
Β© 2017 MoeFront Studio, MUSE Player is MIT licensed.
Thanks goes to these wonderful people (emoji key):
|
εε€’γ‘γγ
π» π¨ π π‘ π€ π β οΈ |
γγ
π π» π€ π π |
Frank Deng
π π» π€ |
| :β: | :β: | :β: |
This project follows the all-contributors specification. Contributions of any kind welcome!