react-cd-player

0.14.1 • Public • Published

React-CD-Player

Installation

npm install --save react-cd-player
yarn add react-cd-player

Usage

import React, { Component } from 'react';
import './assets/css/App.css';
 
import CdPlayer from 'react-cd-player'
 
class App extends Component {
  onPlay=()=>{
    console.log('App onplay')
  }
  onPause=()=>{
    console.log('App onPause')
  }
  render() {
    const musicList =[{
      "id": 1,
      "title": "追光者",
      "artist": "岑宁儿",
      "cover": require('./assets/images/01.jpg'),
      "mp3": 'http://cdn.awbeci.com/music/react-cd-player/01.mp3'
    }, {
      "id": 2,
      "title": "被风吹过的夏天",
      "artist": "林俊杰-金纱",
      "cover": require('./assets/images/02.jpg'),
      "mp3": 'http://cdn.awbeci.com/music/react-cd-player/02.mp3'
    }, {
      "id": 3,
      "title": "小酒窝",
      "artist": "林俊杰-阿sa",
      "cover": require('./assets/images/03.jpg'),
      "mp3": 'http://cdn.awbeci.com/music/react-cd-player/03.mp3'
    }]
    return (
      <div className="App">
        <CdPlayer musicList={musicList} onPlay={this.onPlay} onPause={this.onPause}/>
      </div>
    );
  }
}
 
export default App;
 

property

musicList:array

[{
      "id": 1,
      "title": "追光者",
      "artist": "岑宁儿",
      "cover": require('./assets/images/01.jpg'),
      "mp3": 'http://cdn.awbeci.com/music/react-cd-player/01.mp3'
    }]

methods & events

onPlay

onPause

License

Readme

Keywords

none

Package Sidebar

Install

npm i react-cd-player

Weekly Downloads

1

Version

0.14.1

License

none

Last publish

Collaborators

  • awbeci