Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After unsubscribe, seems camera is still active #142

Open
TLKG opened this issue Feb 4, 2022 · 3 comments
Open

After unsubscribe, seems camera is still active #142

TLKG opened this issue Feb 4, 2022 · 3 comments

Comments

@TLKG
Copy link

TLKG commented Feb 4, 2022

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
image

image

How to completely cancel this camera service?

"ngx-webcam": "^0.3.2"
"@angular/core": "^12.1.4"
@jakehockey10
Copy link

I'm seeing this too

muhammad-usman-anwar added a commit to muhammad-usman-anwar/ngx-webcam that referenced this issue Apr 15, 2022
@josbol
Copy link

josbol commented May 11, 2022

Same things here

@kamilhawdziejuk
Copy link

kamilhawdziejuk commented Sep 13, 2022

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).

#41

Just leaving my 2 cents on that for future users..PR created here:
f5b2372

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants