Socket
Socket
Sign inDemoInstall

rehowl-r18

Package Overview
Dependencies
4
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rehowl-r18

Opinionated React wrapper for Howler.js with React 18


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Install size
23.8 kB
Created
Weekly downloads
 

Readme

Source

Rehowl - React 18 support

Note: All below is just from the old version 0.6.0. That version did not allow react 17/18, probably due to storybook didn't support later react versions than 16.

Rehowl

An opinionated React wrapper for howler.js

Installation

Rehowl has react and howler as peer dependencies so that you can manage your own versions.

npm install --save-dev howler rehowl
yarn add -D howler rehowl

Documentation and Live Examples

Documentation and live examples are available at https://tedmor.in/rehowl

The source of these examples is ./stories

Quick start

It's recommended to view the examples.

However, at its core Rehowl works by using useHowl or <Howl /> to get a howl instance, then playing sounds off that instance with one or more <Play /> components:

import { useHowl, Play } from 'rehowl'
import bark from './assets/bark.mp3'

const Autoplay = () => {
  const { howl, state } = useHowl({ src: bark })
  return (
    <Play howl={howl} />
  )
}

See the docs for examples on how to play multiple sounds off of one howl, how to use audio sprites, and how to control volume, seek, etc.

Rationale

When deciding to use Howler in a React project, a quick Google Search brings you to react-howler.

There are a few issues that make ReactHowler unsuitable for my needs:

  • No support for playing multiple sounds on one Howl instance
  • No support for audio sprites
  • If you want to do more than the very basic API, you must break out the howler instance using refs
  • Use of componentWillReceiveProps

Overall, it feels much more like a barebones wrapper for Howler that doesn't really give you any help when trying to integrate it into your components.

My main goals in this project are to make a library that feels like Howler, if Howler were built for React.

Keywords

FAQs

Last updated on 19 Sep 2022

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