Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-audio-player-component-z

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-audio-player-component-z

A mobile-friendly audio player for React with a modern look and convenient usage.

  • 1.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-42.86%
Maintainers
0
Weekly downloads
 
Created
Source

react-audio-player-component

A mobile-friendly audio player for React with a modern look and convenient usage.

NPM downloads Run ESlint Run Unit tests Run Unit tests

Installation

npm install react-audio-player-component

AudioPlayer Component (Example)

screenshot

screenshot
Minimal Audio player

import React, { useState } from 'react';
import { AudioPlayer } from 'react-audio-player-component';

const Player = () => {
  return (
    <AudioPlayer 
      src="audios/test.mp3"
      minimal={false}
      width={350}
      trackHeight={75}
      barWidth={1}
      gap={1}

      visualise={true}
      backgroundColor="#FFF8DE"
      barColor="#C1D0B5"
      barPlayedColor="#99A98F"

      skipDuration={2}
      showLoopOption={true}
      showVolumeControl={true}

      // seekBarColor="purple"
      // volumeControlColor="blue"
      // hideSeekBar={true}
      // hideTrackKnobWhenPlaying={true}
    />
  )
}

Audio element native props

PropsDescriptionDefaultOptional
srcThe address or URL of the a audio resource that is to be consideredN/ANo
volumeInitial volume level for the audio, minimum being 0, maximum being 10.75Yes
loopSets a flag to specify whether playback should restart after it completesfalseYes
mutedSets a flag that indicates whether the audio is mutedfalseYes
autoplaySets a value that indicates whether to start playing the media automaticallyfalseYes
crossOriginThe CORS setting for this media element. MDN ReferencenullYes
autoplaySets a value indicating what data should be preloaded, if any. Allowed values "", "none", "metadata", "auto"""Yes
playbackRateSets the rate at which media is being played back1.0Yes


Audio element events

AudioPlayer supports all the events for HTMLMediaElement (MDN Reference). All of the events listed in the MDN docs can be passed as a prop to the AudioPlayer


Audio player props

PropsDescriptionDefaultOptional
minimalDisplays a minimal version of the audio player, with only the play/pause button, track bar and timestampfalseYes
widthWidth of the audio playerN/ANo
barWidthWidth of each individual bar in the visualization2Yes
gapGap between each bar in the visualization1Yes
visualiseRepresents whether the audio visualization (waveform) should be displayedtrueYes
trackHeightHeight of the visualization / trackbar area75Yes
backgroundColorBackground color for the audio player#EFEFEFYes
barColorColor for the bars in the visualization. This only applies to bars that have not currently been played"rgb(184, 184, 184)""Yes
barPlayedColorColor for the bars that have been played"rgb(160, 198, 255)""Yes
allowSkipRepresents whether the skip forward/backward options should be displayedtrueYes
skipDurationThe number of seconds to skip forward/backward5Yes
showLoopOptionRepresents whether to show the loop optionstrueYes
showVolumeControlRepresents whether the volume control should be showntrueYes
seekBarColorColor for the audio seek barrgba(140, 140, 140)Yes
volumeControlColorColor for the volumn controlrgba(140, 140, 140)Yes
hideSeekBarHides the seek bar if set to true, the audio will still be seekablefalseYes
hideSeekKnobWhenPlayingHides the seek knob when audio is playing if set to truefalseYes

Keywords

FAQs

Package last updated on 16 Sep 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc