YZarytskyi / react-voice-visualizer

React library for audio recording and visualization using the Web Audio API
https://www.npmjs.com/package/react-voice-visualizer
MIT License
114 stars 22 forks source link

Property 'onStartAudioPlayback' does not exist on type 'Controls'. #22

Closed allison-2 closed 1 month ago

allison-2 commented 1 month ago

Describe the bug Try to use the custom hook for my custom play/pause buttons, but it's show the error : Property 'onStartAudioPlayback' does not exist on type 'Controls'.

To Reproduce Steps to reproduce the behavior:

import { useVoiceVisualizer, VoiceVisualizer } from 'react-voice-visualizer'; .... other codes  const recorderControls = useVoiceVisualizer(); const { setPreloadedAudioBlob, onStartAudioPlayback <-- error here } = recorderControls;

Expected behavior It should not have error when calling the "on" functions. Screenshots

Screenshot 2024-10-09 at 3 01 32 PM

Package info (please complete the following information):

YZarytskyi commented 1 month ago

Hey, onStartAudioPlayback is a parameter of useVoiceVisualizer hook. You can use it like this:

const recorderControls = useVoiceVisualizer({onStartAudioPlayback: () => {} //replace with your callback});