# react-howler-player

> React package to display minimalist audio player UI adding wrapper on howler.js

Latest version **1.3.0** (published 2022-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-howler-player
pnpm add react-howler-player
yarn add react-howler-player
bun add react-howler-player
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2022-08-07 |
| First published | 2019-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 77.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Binod Swain |
| Maintainers | binodswain |
| Keywords | react, audio, player, web, media, howlerjs |

## Links

- npm: https://www.npmjs.com/package/react-howler-player
- Repository: https://github.com/binodswain/react-howler-player
- Homepage: https://github.com/binodswain/react-howler-player#readme
- Issues: https://github.com/binodswain/react-howler-player/issues
- npm.io page: https://npm.io/package/react-howler-player

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2022-08-07
- 1.1.0-alpha.0 (alpha) — 2020-10-27
- 1.2.0 — 2020-12-12
- 1.1.0 — 2020-10-29
- 1.0.11 — 2020-06-23
- 1.0.10 — 2020-06-10
- 1.0.9 — 2020-06-06
- 1.0.8 — 2020-04-09
- 1.0.7 — 2020-04-09
- 1.0.6 — 2020-01-05
- 1.0.5 — 2020-01-05
- 1.0.4 — 2019-11-27
- 1.0.3 — 2019-11-16
- 1.0.2 — 2019-11-09
- 1.0.1 — 2019-11-07
- … 1 more at https://npm.io/package/react-howler-player/versions

## README

# react-howler-player

[![release](https://badgen.net/npm/v/react-howler-player)](https://www.npmjs.com/package/react-howler-player)
[![open-issues](https://badgen.net/github/open-issues/binodswain/react-howler-player)](https://github.com/binodswain/react-howler-player/issues)
[![license](https://badgen.net/github/license/binodswain/react-howler-player)](https://github.com/binodswain/react-howler-player/blob/master/LICENSE)
[![Test Status](https://github.com/binodswain/react-howler-player/workflows/Test/badge.svg)](https://github.com/binodswain/react-howler-player/actions?query=workflow%3ATest)
[![Build Status](https://github.com/binodswain/react-howler-player/workflows/Build/badge.svg)](https://github.com/binodswain/react-howler-player/actions?query=workflow%3ABuild)

This is a simple, accessible audio player built using Reactjs and Howlerjs.
[view demo](https://binodswain.github.io/react-howler-player/)

## [howler.js](https://howlerjs.com/)

Javascript audio library for the modern web. howler.js makes working with audio in JavaScript easy and reliable across all platforms.

## Usage

```bash
npm install --save howler react-howler-player
```

```jsx
import React, { Component } from "react";
import Player from "react-howler-player";

const App = () => {
    const onPlayerReady = (data) => {
        console.log(data);
    };

    const timeUpdate = (data) => {
        console.log(data);
    };

    return (
        <div>
            <Player
                src={["audio file URL"]}
                isDark={true}
                onTimeUpdate={timeUpdate}
                onLoad={onPlayerReady}
            />
        </div>
    );
};
```

## Example

```bash
git clone git@github.com:binodswain/react-howler-player.git
cd react-howler-player
npm i
npm run build

cd example
npm i
npm start
```

This will start a React app (bootstrapped with create-react-app) with multiple player instances.
One player instance with remote URL and one with local file.

## Screenshots

### Default Player

![Screenshot 1](/example/player-light.png?raw=true "player")

### Player with dark mode

![Screenshot 2](/example/player-dark.png?raw=true "player darkmode")

## Props passed to component

| attribute     |   type    | optional | details                                                                                      |
| ------------- | :-------: | :------: | :------------------------------------------------------------------------------------------- |
| src           |   Array   |  false   | Source of audio playback                                                                     |
| isDark        |  Boolean  |   true   | Flag to switch between light and dark theme                                                  |
| onTimeUpdate  | function  |   true   | On playback progress, timestamp obj is passed to the function                                |
| loadingText   | function  |   true   | Text displayed while preparing the playback.(default val: 'Preparing')                       |
| preparingComp | JSX Comp. |   true   | Component to display instead of loading text. `(preparingComp                                |  | loadingText)` |
| speedPanel    |  string   |   true   | Position of audio playback rate list. ('top', 'bottom', 'relative'). defaultVal : 'relative' |
| onLoad        | function  |   true   | Callback function that passes howler audio instance and couple of basic information          |
| onPlay        | function  |   true   | Called when audio starts or resumes playing                                                  |
| onPause       | function  |   true   | Called when audio is paused                                                                  |
| onEnd         | function  |   true   | Called when media finishes playing                                                           |
| profile       |  string   |   true   | Player profile. ['generic', 'minimal', 'top_progress']                                       |

## Features:

-   Clean: uses semantic elements for UI.
-   Controls: supports Keyboard events/ controls.
-   Audio Format: supports a wide range of audio format.

## License

MIT © [binodswain](https://github.com/binodswain)

---
_Source: https://npm.io/package/react-howler-player · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
