Coder Social home page Coder Social logo

react-cl-audio-player's Introduction

react-cl-audio-player

A simple audio player with ReactJS and CSS3.

Inspiration: Thanks Rovane Durso

TODO

  • shuffle
  • mute/unmute
  • repeat song
  • cover
  • play/pause song
  • prev/next song
  • Drag n Drop of the songs
  • Better volume control
  • List of the songs
  • Drag of the progress bar

Demo & Examples

Live demo: http://cezarsmpio.github.io/react-cl-audio-player/

To run it on your local environment:

Using yarn

yarn install
yarn start
yarn build // to build

Using npm

npm install
npm run start
npm run build // to build

Then open localhost:3000.

Installation

npm install react-cl-audio-player --save

Usage

import AudioPlayer from 'react-cl-audio-player';

<AudioPlayer
  songs={songs}
  autoplay
/>

Properties

propTypes = {
  songs: PropTypes.array.isRequired,
  autoplay: PropTypes.bool,
  onTimeUpdate: PropTypes.func,
  onEnded: PropTypes.func,
  onError: PropTypes.func,
  onPlay: PropTypes.func,
  onPause: PropTypes.func,
  onPrevious: PropTypes.func,
  onNext: PropTypes.func,
};

Songs model:

const songs = [
  {
    url: 'path/to/mp3',
    cover: 'path/to/jpeg',
    artist: {
      name: 'Metallica',
      song: 'Fuel'
    }
  },
  {
    url: 'path/to/your/mp3',
    artist: {
      name: 'X Japan',
      song: 'Art of Life'
    }
  }
];

// Then call
<CLAudioPlayer
  songs={songs}
  autoplay
/>

CSS classes

  • .no-height - A helper class for songs without covers
  • .player-container
  • .player-cover
  • .artist-info
  • .artist-name
  • .artist-song-name
  • .player-progress-container
  • .player-progress-value
  • .player-options
  • .player-buttons
  • .player-btn
  • .player-btn i (.fa .fa-play .fa-pause .fa-volume .fa-volume-off .fa-forward .fa-backward .fa-repeat .fa-random)
  • .player-btn.big.medium.small.active.volume:disabled
  • .player-controls

PS: react-cl-audio-player uses font-awesome, the used classes are:

.fa .fa-play .fa-pause .fa-volume .fa-volume-off .fa-forward .fa-backward .fa-repeat .fa-random

Don't forget to import it into your project or feel free to use your own icons.

Notes

Works perfectly in Chrome, Firefox, Safari and IE.

Version 2.0 was rewritten.

License

MIT License.

Made with ❤️

react-cl-audio-player's People

Contributors

cezarsmpio avatar indatawetrust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-cl-audio-player's Issues

Classnames

When requiring the module error: "Cannot find module Classnames"

Module parse failed: Unexpected token.

FULL ERROR:

Module parse failed: Unexpected token.
You may need an appropriate loader to handle this file type.

I really like the plugin. But I tried to use it with create-react-app
and it seems to have problem with webpack config.
do we need custom config in order to use this?
Greetings

Gapping Loop

Whenever I play a song on a loop there is a gap before the song start, is there any way to crossfade over that gap or to remove the gap itself

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.