1.0.2 • Published 7 months ago

react-mic-visualizer v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-mic-visualizer

Usage

npm i react-mic-visualizer

Basic example

import { BarVisualizer } from 'react-mic-visualizer';

const [stream, setStream] = useState<MediaStream | null>(null);

useEffect(() => {
  navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
    setStream(stream);
  });
}, []);

return stream ? <BarVisualizer stream={stream} /> : null;

Props

PropDescriptionDefaultRequired
streamMediaStream-Yes
sizeSize of the visualizer25No
circleWhether to use circle visualizertrueNo
addTransparencyPass this prop to make the visualizer transparent. Adds 0.75 opacity.falseNo
paddingIf provided it will be used instead of the default value, which gets calculated like this ${(32 / 100) * WIDTH}px-No
borderRadiusOnly works if circle is false-No
bgColorBackground color#f3f4f6No
barBgColorBar background color#D1D5DBNo
barColorBar color#16a34aNo

Play and test

npm run storybook