]> git.r.bdr.sh - rbdr/junction/blame_incremental - extension/media.js
Add docker container / docker-compose
[rbdr/junction] / extension / media.js
... / ...
CommitLineData
1const internals = {
2 mediaStream: null
3};
4
5export default {
6 async start() {
7
8 internals.mediaStream = internals.mediaStream || await navigator.mediaDevices.getUserMedia({
9 audio: true
10 });
11
12 return internals.mediaStream;
13 },
14
15 stop() {
16
17 if (!internals.mediaStream) {
18 return;
19 }
20
21 for (const track of internals.mediaStream.getAudioTracks()) {
22 track.stop();
23 }
24
25 internals.mediaStream = null;
26 }
27};