ngx-webcam
ngx-webcam copied to clipboard
After unsubscribe, seems camera is still active
To utilize it:
import {WebcamImage, WebcamInitError, WebcamUtil} from 'ngx-webcam';
export class MyComponent implements OnInit, OnDestroy
{
...
private nextWebcam: Subject<boolean|string> = new Subject<boolean|string>();
constructor() { this.openWebCam();}
public get nextWebcamObservable(): Observable<boolean|string>
{
return this.nextWebcam.asObservable();
}
ngOnDestroy()
{
this.nextWebcam.unsubscribe();
...
}
}
After exiting the page, still shows
How to completely cancel this camera service?
"ngx-webcam": "^0.3.2"
"@angular/core": "^12.1.4"
I'm seeing this too
Same things here
Hi, not sure why first PR is waiting for such a long time. I faced that issue, too and executing this.mediaStream.removeTrack(track); really helps.
Unfortunately it does not resolve the issue always (there still might be some delay of turning camera off). What worked in my case is to call this.nextWebcam.complete(); on the code that closes camera connection (triggered in closeModal method in my case).
https://github.com/basst314/ngx-webcam/issues/41
Just leaving my 2 cents on that for future users..PR created here: https://github.com/basst314/ngx-webcam/pull/155/commits/f5b237293b6e79299ec62a6ff2dabc762e963385