removeAudioTracks(stream) removes the stream's audio tracks without
stopping the underlying capture — the tracks are detached, not
stopped. Pair it with copyAudioTracks
to swap a device live, or use stopStream
when you actually want to release the hardware. Part of
pota/use/stream.
| Argument | Type | Description |
|---|---|---|
stream |
MediaStream |
Stream to detach all audio tracks from. |
Returns: nothing — it mutates stream in place.
Detach every audio track from a capture stream while leaving its video running.
import { removeAudioTracks } from 'pota/use/stream'
const stream = await navigator.mediaDevices.getUserMedia({
audio: true,
video: true,
})
removeAudioTracks(stream)