Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e3de91a6f | |||
| 6e0c528126 |
@@ -22,6 +22,9 @@ export function useSilenceDetector(options: SilenceDetectorOptions = {}) {
|
||||
function start(stream: MediaStream, onSilence: () => void): void {
|
||||
stop()
|
||||
audioCtx = new AudioContext()
|
||||
// Some browsers start AudioContext in "suspended" state — resume so
|
||||
// getByteFrequencyData returns real values instead of all zeros.
|
||||
audioCtx.resume().catch(() => {})
|
||||
const source = audioCtx.createMediaStreamSource(stream)
|
||||
const analyser = audioCtx.createAnalyser()
|
||||
analyser.fftSize = 256
|
||||
|
||||
Reference in New Issue
Block a user