Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 992 Bytes

useHowl.stories.mdx

File metadata and controls

30 lines (23 loc) · 992 Bytes

import { Meta, ArgTypes, Description, Story, Preview } from '@storybook/blocks' import { useState } from 'react' import { useHowl } from '../src/useHowl.js' import sound1 from './static/audio/sound1.mp3'

useHowl

function MyComponent() {
  const { howl, state, error, load } = useHowl({
    src: './mysound.mp3',
  })
  // howl can be handed to <Play />
}

Values provided by useHowl are:

Variable Description
howl Howl instance
state 'unloaded', 'loading', or 'loaded'
error { message, id } of load error, if any.
load Call this function to load source if you set preload to false.