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

Release and Open camera zbarcam again when camera is used in other application #38

Open
vickypaulantono opened this issue Jul 29, 2020 · 3 comments

Comments

@vickypaulantono
Copy link

I have a issue with zbarcam on android.

While i'm minimize my application (on_pause, zbarcam.play = False ) and open some camera application, then i'm go back again open my application (on_resume, zbarcam.play = True).

Zbarcam can't start camera service again and camera zbarcam in my application is still freeze.
Any fix for this issue?

Thank You

@ahmed-asn
Copy link

you can start and stop the detector from zbarcam. you need a object from the class ZBarCam and this object has the attribute start and stop. so you can start and stop it with: object.stop, object.start

@vickypaulantono
Copy link
Author

Thank You for your response,

Stop camera is just pause camera detector not release or destroy camera.

I want is like this documentation
https://developer.android.com/reference/android/hardware/Camera#release()

While i minimize my application , it will release/destroy the existing camera and then if i'm open camera again it's re-intialize zbarcam without load .kv ZBarCam again

class MyApp(App):`
def __init__(self,**kwargs):
        self.zbarcam = ZBarCam()
def on_pause(self):
    if self.zbarcam != None:
        self.zbarcam.stop()
        self.zbarcam = None ###delete existing object ZBarCam
    super().on_pause()
def on_resume(self):
    if self.zbarcam == None:
        self.zbarcam = ZBarCam() ###re-intialize object ZBarCam
        self.zbarcam.stop()
    super().on_resume()

@102757017
Copy link

I have the same question.

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

3 participants