https://github.com/bsonntag/stop-media-stream
Stops and removes all tracks in a MediaStream.
https://github.com/bsonntag/stop-media-stream
mediastream webrtc
Last synced: 6 months ago
JSON representation
Stops and removes all tracks in a MediaStream.
- Host: GitHub
- URL: https://github.com/bsonntag/stop-media-stream
- Owner: bsonntag
- License: mit
- Created: 2016-08-01T17:53:56.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-08-30T04:17:12.000Z (about 1 year ago)
- Last Synced: 2025-03-25T05:51:17.684Z (7 months ago)
- Topics: mediastream, webrtc
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/stop-media-stream
- Size: 770 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stop-media-stream
[](https://www.npmjs.com/package/stop-media-stream)
[](https://circleci.com/gh/bsonntag/stop-media-stream)
[](https://www.npmjs.com/package/stop-media-stream)Stops and removes all tracks in a MediaStream.
This will release the camera, if the MediaStream was obtained with
[getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia).## Installation
Install with:
```sh
$ npm install stop-media-stream
```Or:
```sh
$ yarn add stop-media-stream
```## Usage
```js
import stopMediaStream from 'stop-media-stream';// get a media stream somehow
navigator.mediaDevices.getUserMedia(constraints)
.then(mediaStream => {
// Use your media stream and when you're done with it:
stopMediaStream(mediaStream);
});
```## Contributing
Please feel free to submit any issues or pull requests.
## License
MIT