All Projects → wenliangdai → react-audioplayer

wenliangdai / react-audioplayer

Licence: MIT license
A customizable HTML5 audio player for React.js

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-audioplayer

Swift Radio Pro
Professional Radio Station App for iOS!
Stars: ✭ 2,644 (+3731.88%)
Mutual labels:  audio-player
strumpract
Various tools for musicians.
Stars: ✭ 20 (-71.01%)
Mutual labels:  audio-player
soundcloud audio player
🎹 SoundCloud Audio Player for Flutter.
Stars: ✭ 50 (-27.54%)
Mutual labels:  audio-player
React Native Audio Recorder Player
react-native native module for audio recorder and player.
Stars: ✭ 248 (+259.42%)
Mutual labels:  audio-player
jplayer-skin-audiocheck
A responsive HTML5 jPlayer skin with playlist.
Stars: ✭ 16 (-76.81%)
Mutual labels:  audio-player
songturtle
🐢 Play, slow down, and loop sections of audio files in the browser 🐢
Stars: ✭ 26 (-62.32%)
Mutual labels:  audio-player
Musikcube
a cross-platform, terminal-based music player, audio engine, metadata indexer, and server in c++
Stars: ✭ 2,663 (+3759.42%)
Mutual labels:  audio-player
pushtape-player.js
Customizable JS audio page player with global playback controls and autoscan (mutationobserver), built on Soundmanager2.
Stars: ✭ 27 (-60.87%)
Mutual labels:  audio-player
parlatype
GNOME audio player for transcription
Stars: ✭ 151 (+118.84%)
Mutual labels:  audio-player
AudioRecorder
Android 音频录制、播放,最近在项目要用到录音的功能,研究了几天,看了很多的资料,今天在这里分享记录一下以便回头查看。Android给我们提供了两个录音的API接口:MediaRecord、AudioRecoder
Stars: ✭ 23 (-66.67%)
Mutual labels:  audio-player
dart vlc
🎞 Flutter audio / video playback, broadcast & recording library for Windows & Linux.
Stars: ✭ 439 (+536.23%)
Mutual labels:  audio-player
minimal-player
This is a minimal, clean audio/music/mp3 player with spinning cover images, built with jQuery, TweenMax.js and SVG images.
Stars: ✭ 48 (-30.43%)
Mutual labels:  audio-player
TonUINO
Alternative TonUINO Firmware
Stars: ✭ 112 (+62.32%)
Mutual labels:  audio-player
React Audio Component
A beautiful example project demonstrating how to build an audio player in React.
Stars: ✭ 239 (+246.38%)
Mutual labels:  audio-player
chu music
网页音乐播放器,仅1.4K,支持咪咕等等,随心更新中~~支持小程序
Stars: ✭ 16 (-76.81%)
Mutual labels:  audio-player
React H5 Audio Player
React audio player component with UI. It provides time indicator on both desktop and mobile devices.
Stars: ✭ 226 (+227.54%)
Mutual labels:  audio-player
waveplayer.js
An HTML5 based audio player with a waveform view
Stars: ✭ 73 (+5.8%)
Mutual labels:  audio-player
web-rpi-fm
Web interface for Raspberry Pi fm transmitter. Made using Vue.js and Python.
Stars: ✭ 33 (-52.17%)
Mutual labels:  audio-player
sounds
Flutter plugin for sound. Audio recorder and player.
Stars: ✭ 74 (+7.25%)
Mutual labels:  audio-player
audioStreamDemo
A music player created in swift using AVPlayer to stream audio from server.
Stars: ✭ 33 (-52.17%)
Mutual labels:  audio-player

react-audioplayer

Build Status npm package

A customizable HTML5 audio player for React.js

Live demo

Features

  • A ready-to-use web audio player for React.js
  • Highly-customizable. You can change theme color, size, functions of this player as you want.
  • Just one single component on the top to use (Almost no learning cost).

Install

  • npm: npm install react-audioplayer --save
  • yarn: yarn add react-audioplayer

Usage

A simple example below.

import Audio from 'react-audioplayer';
// In your render() function:
<Audio
  width={600}
  height={400}
  autoPlay={true}
  playlist={somePlaylist}
/>

Acceptable props

prop name value type default value isRequired explanation
width number 400 no Width of the component (px)
height number fullPlayer ? 300 : 52 no Height of the component (px)
color string "#212121" no Theme color of the player
autoPlay bool false no Automatically playing when loaded
volumeOrientationDown bool false no Make the volume bar head downwards (make it true if the player is positioned at the very top of your webpage)
fullPlayer bool false no If true, shows song image given in the playlist. Otherwise just shows the basic player
comment bool false no If true, enables comment function. When fullPlayer is false, this is forced to be false. You need to specify onCommentSubmit to handle user input
onCommentSubmit (text) Function null no When a user submits a new comment, this function will be invoked and the input content will be passed as an argument
playlist array null yes An array of song information objects, see below for details
style object null no A normal style object. For example, you can add border or boxShadow to the component. If you also set width or height here, it will override the one you set using width or height API

playlist prop

playlist is an array of songObj, where

songObj = {
  name: string, // song name
  src: string, // song source address
  img: string, // (optional) song image source address
  comments: an commentObj array // (optional) comments to display of that song
}

commentObj = {
  time: number,
  content: string
}

songObj.img is required when fullPlay = true, songObj.comments is required when comment = true.

Manually control the state of the player in code

To play/pause/skip-to-next/skip-to-previous the player in code, four event listeners are added inside the <Audio /> component.

The name of these events are:

  • audio-play
  • audio-pause
  • audio-skip-to-next
  • audio-skip-to-previous

and a typical example:

class App extends React.Component {
  someMethod() {
    // Some code ...
    // This code can only be able to execute when the audio component is already mounted
    ReactDOM.findDOMNode(this.audioComponent).dispatchEvent(new Event('audio-play'));
  }

  render() {
    return (
      <Audio
        width={600}
        height={300}
        playlist={playlist}
        
        // store a reference of the audio component
        ref={audioComponent => { this.audioComponent = audioComponent; }}
      />
    );
  }
}

As you can see in the example above, there are two steps:

  1. Store the audio component using ref
  2. Get the DOM node (ReactDOM.findDOMNode) and dispatch the event (dispatchEvent)

TODO

  • Loading animation and optimisation

Development

$ git clone https://github.com/wenliangdai/react-audioplayer.git
$ npm install
$ npm start

Then a localhost is open on port 8080.

ChangeLog

Details changes for each release are documented in the release notes or the ChangeLog.md file.

Need help or find a bug?

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].