Socket
Socket
Sign inDemoInstall

react-simple-audio-player

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-simple-audio-player

React component for playing audio files.


Version published
Weekly downloads
39
increased by85.71%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React Simple Audio Player

A React component with graphics for playing audio files

Demo

Usage

npm install react-simple-audio-player --save
import React, { Component } from 'react'
import PlayAudio from 'react-simple-audio-player'

class App extends Component {
  render () {
    return <PlayAudio url={'http://www.noiseaddicts.com/samples_1w72b820/4186.mp3'} />
  }
}
export default App;

The component uses react-player package to play media and add simple design and controls to extend the package.

Props

PropDescriptionDefault
urlThe url of an audio to play
widthSet the width and height (height is equal to width) of the player60px
simpleModeSet to true disable seconds counter, automatically true with width less then 45pxfalse
colorScalePass array of 5 colors for theme personalisationscaled red shades (see demo)

Changing color theme example

import React, { Component } from 'react'
import PlayAudio from 'react-simple-audio-player'
import chroma from "chroma-js"

const colorScale = chroma
    .scale([
        '#0199CB',
        '#ffffff',
    ])
    .mode('lch')
    .colors(5)

class App extends Component {
    render () {
        return <PlayAudio url={'http://www.noiseaddicts.com/samples_1w72b820/4186.mp3'} colorScale={colorScale} />
    }
}
export default App

Result:

Demo

Keywords

FAQs

Last updated on 04 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc