fix: defer stopping media stream tracks until media recorder finishes stopping
This commit is contained in:
@@ -110,8 +110,7 @@ export default function LiveVoiceCapture({
|
|||||||
if (!recorder || recorder.state !== 'recording') return
|
if (!recorder || recorder.state !== 'recording') return
|
||||||
recorder.stop()
|
recorder.stop()
|
||||||
clearTimer()
|
clearTimer()
|
||||||
stopStream()
|
}, [clearTimer])
|
||||||
}, [clearTimer, stopStream])
|
|
||||||
|
|
||||||
const startRecording = async () => {
|
const startRecording = async () => {
|
||||||
setMicError(null)
|
setMicError(null)
|
||||||
@@ -141,6 +140,7 @@ export default function LiveVoiceCapture({
|
|||||||
)
|
)
|
||||||
const blob = new Blob(chunksRef.current, { type: resolvedMime })
|
const blob = new Blob(chunksRef.current, { type: resolvedMime })
|
||||||
chunksRef.current = []
|
chunksRef.current = []
|
||||||
|
stopStream()
|
||||||
try {
|
try {
|
||||||
assertVoiceMemoBlobSize(blob)
|
assertVoiceMemoBlobSize(blob)
|
||||||
finishRecording(blob, resolvedMime, durationSec)
|
finishRecording(blob, resolvedMime, durationSec)
|
||||||
|
|||||||
Reference in New Issue
Block a user