stopTrack

stopTrack(track) calls track.stop() on a single MediaStreamTrack. To stop every track on a stream use stopTracks, or the polymorphic stopStream. Part of pota/use/stream.

Examples

Stop one track

Stop a single track pulled off a stream, leaving the others running.

import { stopTrack } from 'pota/use/stream'

const stream = await navigator.mediaDevices.getUserMedia({
	video: true,
})
stopTrack(stream.getVideoTracks()[0])