Skip to content

Commit 15771c5

Browse files
authored
Fix 'Can't close an AudioContext twice' for firefox (#7)
1 parent 7029e72 commit 15771c5

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-audio-visualize",
33
"private": false,
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"license": "MIT",
66
"author": "",
77
"repository": {
@@ -21,7 +21,8 @@
2121
"audio waveform",
2222
"waveform",
2323
"audio visualization",
24-
"visualization"
24+
"visualization",
25+
"live visualize"
2526
],
2627
"files": [
2728
"dist"

src/LiveAudioVisualizer/LiveAudioVisualizer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const LiveAudioVisualizer: (props: Props) => ReactElement = ({
107107
}, [mediaRecorder.stream]);
108108

109109
useEffect(() => {
110-
if (analyser ?? mediaRecorder.state === "recording") {
110+
if (analyser && mediaRecorder.state === "recording") {
111111
report();
112112
}
113113
}, [analyser, mediaRecorder.state]);
@@ -129,7 +129,7 @@ const LiveAudioVisualizer: (props: Props) => ReactElement = ({
129129
) {
130130
context.close();
131131
}
132-
}, [analyser]);
132+
}, [analyser, context.state]);
133133

134134
const processFrequencyData = (data: Uint8Array): void => {
135135
if (!canvasRef.current) return;

0 commit comments

Comments
 (0)