An Mp3 player to play any audio file based on ReactJS

Usage no npm install needed!

<script type="module">
  import reactMp3Player from '';


React mp3 Player

An Mp3 player to play any audio file based on ReactJS

Table of Contents


Install via NPM

npm install react-mp3-player

or use yarn

yarn add react-mp3-player


Import the Playlist component

import Playlist from 'react-mp3-player';

The tracks format will be ann array of objects, each object containing a name, description, src mp3 and an optional image

const tracks = [{ img: '', name:'MP3', desc: 'Description 1', src:'Audio.mp3'},
{ img: '', name:'MP3 #2', desc: 'Description 2', src:'Audio2.mp3'}]

Additional properties can be added to the component such as a right or left offset to decrease the width of the player as well as being able to choose the breakpoint for switching to mobile view, these options are passed into the playlist component in an object as props.

const playlistOverideStylingOpts = {
  offset : {
    left : 300
  breakpoint : {
    maxWidth : 768

Add the Player component and pass it the relative mp3 tracks as well as any addition style options as opts

<Playlist tracks={tracks} opts={playlistOverideStylingOpts}/>


Desktop Alt text

Desktop Hidden Alt text

Mobile Alt text

Mobile Hidden Alt text

Adding new features to the mp3

Make any changes or additional features in the Player.js component and update the version (in the package.json) by 0.0.1 and then push all your changes to the repo.

Publish to NPM

Firstly make sure to build to the dist folder. Run

yarn build

Then publish the update to npm by running

npm publish

Your update should now be live on NPM. Make sure to update the package in your project by running

yarn upgrade react-mp3-player


Liam Riley - Dannish Hussain - Austin Kershaw -