tangled
alpha
login
or
join now
stream.place
/
streamplace
74
fork
atom
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
add camera useEffect cleanup function
Jordan Weatherby
1 week ago
4e80d90a
cccc4fce
+11
1 changed file
expand all
collapse all
unified
split
js
components
src
components
mobile-player
video-async.native.tsx
+11
js/components/src/components/mobile-player/video-async.native.tsx
···
315
315
const localMediaStream = lms;
316
316
317
317
useEffect(() => {
318
318
+
let acquiredStream: WebRTCMediaStream | null = null;
319
319
+
318
320
if (ingestMediaSource === IngestMediaSource.DISPLAY) {
319
321
mediaDevices
320
322
.getDisplayMedia()
321
323
.then((stream: WebRTCMediaStream) => {
324
324
+
acquiredStream = stream;
322
325
console.log("display media", stream);
323
326
setLocalMediaStream(stream);
324
327
})
···
344
347
},
345
348
})
346
349
.then((stream: WebRTCMediaStream) => {
350
350
+
acquiredStream = stream;
347
351
setLocalMediaStream(stream);
348
352
349
353
let errs: string[] = [];
···
374
378
);
375
379
});
376
380
}
381
381
+
382
382
+
return () => {
383
383
+
if (acquiredStream) {
384
384
+
acquiredStream.getTracks().forEach((track) => track.stop());
385
385
+
}
386
386
+
setLocalMediaStream(null);
387
387
+
};
377
388
}, [ingestMediaSource, ingestCamera]);
378
389
379
390
useEffect(() => {