Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/moefront/muse

🎧 All you need is a simple and diligent HTML 5 music player written in React.
https://github.com/moefront/muse

audio html5 mobx muse player react redux typescript

Last synced: 5 days ago
JSON representation

🎧 All you need is a simple and diligent HTML 5 music player written in React.

Awesome Lists containing this project

README

        


MUSE

[![Build Status](https://travis-ci.org/moefront/muse.svg?branch=master)](https://travis-ci.org/moefront/muse)
[![Coverage Status](https://coveralls.io/repos/github/moefront/muse/badge.svg?branch=master)](https://coveralls.io/github/moefront/muse?branch=master)
[![npm](https://img.shields.io/npm/v/muse-player.svg?style=flat)]()
![npm download](https://img.shields.io/npm/dm/muse-player.svg)
[![devDependencies](https://img.shields.io/david/dev/moefront/muse.svg?style=flat)]()
[![license](https://img.shields.io/github/license/moefront/muse.svg?style=flat)]()
![built by](https://img.shields.io/badge/built_by-MoeFront-ff69b4.svg)

MUSE is a simple and diligent HTML5 audio player made with ❀ :)

[δΈ­ζ–‡ζ–‡ζ‘£](https://github.com/moefront/muse/wiki/MUSE-5:-Getting-Start) / [Redux build](https://github.com/moefront/muse/tree/v5-redux) / [Old version](https://github.com/moefront/muse/tree/v4-legacy)

Table of Contents
=================

* [Demo](#demo)
* [Tech Stack](#tech-stack)
* [Installation](#installation)
* [Install via Package Manager](#install-via-package-manager)
* [Install via Git](#install-via-git)
* [Download ZIP directly](#download-zip-directly)
* [Usage](#usage)
* [Easily render player for single page](#easily-render-player-for-single-page)
* [Generating music JSON from Netease Cloud Music automatically](#generating-music-json-from-netease-cloud-music-automatically)
* [Using MUSE in your own project](#using-muse-in-your-own-project)
* [in React Project with webpack bundling](#in-reactjs-project-with-webpack-bundling)
* [RequireJS or other AMD module loader](#requirejs-or-other-amd-module-loader)
* [Others](#others)
* [Features](#features)
* [Commands](#commands)
* [Related Projects](#related-projects)
* [Troubleshooting](#troubleshooting)
* [Contributing](#contributing)
* [Docs](#developing-docs)
* [Browser Supports](#browser-supports)
* [Todo](#todo-list)
* [License](#license)
* [Contributors](#contributors)

## Demo

Have a look at [here](https://moefront.github.io/muse/dist).

## Tech Stack

- React 16
- TypeScript
- MobX
- mobx-react
- Stylus

## Installation

### Install via Package Manager

MUSE is available in [npmjs](https://www.npmjs.com/package/muse-player). You can install it by both **npm** and **yarn**.

```shell
$ yarn add muse-player # using yarn
$ npm install --save-dev muse-player # using npm
```

### Install via Git

```shell
$ git clone https://github.com/moefront/muse
$ cd muse
$ yarn install # or: npm install
```

### Download ZIP Directly

Click ```Clone or download``` then choose ```Download ZIP```, or redirect to release page to download a release version.

## Features

- Build with React.js and Mobx
- Both Mobx version(main) & Redux version(before 5.2.7)
- Full lyric support
- Lyric offset fixing
- Right-click menu is finally supported
- Fullscreen mode
- Middlewares and Custom layouts (new)
- Responsive design
- Better mobile side experience
- ...

## Usage

### Easily render player for single page
---
Firstly, import **./dist/assets/muse-player.js** to your own page (Stylesheet has been injected in this Javascript file):
```html

```

We recommend that you import ```muse-player.js``` from unpkg, where you can get the latest version of MUSE:
```javascript

```

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()``` or ```YMPlayer.render()``` to render a player:

```javascript
/**
* 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'));
```

---

### Generating music JSON from Netease Cloud Music automatically

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.

```shell
$ 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 .

---

### Using MUSE in your own project

---

You must have muse-player already installed.

#### in React.js Project with webpack bundling

```javascript
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(
,
node
);

```

#### RequireJS or other AMD module loader

```javascript
require(['muse-player'], function(MuseDOM) {
MuseDOM.render(...);
});
```

#### Others

```html

```

This will export MuseDOM instance to ```window```:
```javascript
window.MuseDOM.render();
```

## Commands

- Run server in dev mode: ```yarn serve```
- Run server in production mode: ```yarn serve:dist```
- Build a dist: ```yarn dist```

## Related Projects

Projects related to MUSE below can help you construct MUSE Player on your site easily. Thanks for their hard working!

- **muse-json-generator** by [@kokororin](https;//github.com/kokororin): https://github.com/moefront/muse-json-generator
- **typecho-plugin-ymplayer** by [@kokororin](https;//github.com/kokororin): https://github.com/kokororin/typecho-plugin-ymplayer
- **muse-plugin-desktop-lyric**: https://github.com/kirainmoe/muse-plugin-desktop-lyric

## Troubleshooting

You can find solutions of most problems on [Wiki](https://github.com/moefront/muse). If not, please open an issue whenever you are facing a problem, or contact us at [email protected].

## Contributing

Both contributing code to this project and telling us your suggestion and ideas are welcomed.

Thanks those who contributed to MUSE Player: [@kokororin](https://github.com/kokororin), [@frank-deng](https://github.com/frank-deng).

## Developing Docs

You can find a detailed documentation about APIs, methods, specification, etc. on WiKi.

## Browser supports

![IE](https://github.com/alrra/browser-logos/raw/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) | ![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/chrome_12-48/chrome_12-48_48x48.png) | ![Firefox](https://github.com/alrra/browser-logos/raw/master/src/archive/firefox_3.5-22/firefox_3.5-22_48x48.png) | ![Opera](https://github.com/alrra/browser-logos/raw/master/src/archive/opera_15-32/opera_15-32_48x48.png) | ![Safari](https://github.com/alrra/browser-logos/raw/master/src/archive/safari_1-7/safari_1-7_48x48.png)
--- | --- | --- | --- | --- |
IE 10+ βœ” | Chrome 24.0+ βœ” | Firefox 24.0+ βœ” | Opera 15.0+ βœ” | Safari 7.0+ βœ” |

## Todo list

- [x] Custom layouts full support
- [ ] Documents for developing (plugins, themes...)

## License

Β© 2017 MoeFront Studio, MUSE Player is MIT licensed.

## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

| [
εŸε€’γ‘γ‚ƒγ‚“](https://kirainmoe.com/)
[πŸ’»](https://github.com/kirainmoe/muse/commits?author=kirainmoe "Code") [🎨](#design-kirainmoe "Design") [πŸ“–](https://github.com/kirainmoe/muse/commits?author=kirainmoe "Documentation") [πŸ’‘](#example-kirainmoe "Examples") [πŸ€”](#ideas-kirainmoe "Ideas, Planning, & Feedback") [πŸ‘€](#review-kirainmoe "Reviewed Pull Requests") [⚠️](https://github.com/kirainmoe/muse/commits?author=kirainmoe "Tests") | [
そら](http://kokororin.github.io)
[πŸ›](https://github.com/kirainmoe/muse/issues?q=author%3Akokororin "Bug reports") [πŸ’»](https://github.com/kirainmoe/muse/commits?author=kokororin "Code") [πŸ€”](#ideas-kokororin "Ideas, Planning, & Feedback") [πŸ”Œ](#plugin-kokororin "Plugin/utility libraries") [🌍](#translation-kokororin "Translation") | [
Frank Deng](http://frank-deng.github.io)
[πŸ›](https://github.com/kirainmoe/muse/issues?q=author%3Afrank-deng "Bug reports") [πŸ’»](https://github.com/kirainmoe/muse/commits?author=frank-deng "Code") [πŸ€”](#ideas-frank-deng "Ideas, Planning, & Feedback") |
| :---: | :---: | :---: |

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!