Coder Social home page Coder Social logo

t1's Introduction

Cannot start/stop camera in a reliable way

Environment

  • Nuget package: Camera.MAUI 1.4.4
  • Target: MacCatalyst

Problem description

I want to use the camera in assistant-like dialog where, i.e. a number of views with a common design each connected by a forward and a backward button. The common design is implemented by a TcameraPage and it's varying content is implemented by several ContentView that are injected into TcameraPage.

In this test the assistant consists of 4 steps. In step 2 a cameraview is needed. This is implemented by CameraAssistantView. When moving into step 2 the CameraAssistantView is injected and the camera should start, when moving out the camera should stop.

Unfortunately this works only sometimes. If not the StartCamera firstly results in an AccessError. Then on the second try the result is Success and one can see the playback picture on the screen. But upon leaving the step 2 the StopCamera action results in AccessError.

2023-08-22 16:51:29.166 T1[60533:1070729] ENTER T1.CameraAssistantView
2023-08-22 16:51:29.166 T1[60533:1070729] Set Content
2023-08-22 16:51:34.412 T1[60533:1070729] CamerasLoaded
2023-08-22 16:51:34.547 T1[60533:1070800] Warning: observer object was not disposed manually with Dispose()
2023-08-22 16:51:34.547 T1[60533:1070800] Warning: observer object was not disposed manually with Dispose()
Thread started:  #12
2023-08-22 16:51:36.093 T1[60533:1070729] Camera FaceTime HD-Kamera start AccessError
2023-08-22 16:51:36.383 T1[60533:1070729] Camera FaceTime HD-Kamera start Success
Thread started:  #13
Thread started:  #14
Thread finished: <Thread Pool> #9
Thread started:  #15
Thread started:  #16
Thread started:  #17
2023-08-22 16:51:52.377 T1[60533:1070729] LEAVE T1.CameraAssistantView
2023-08-22 16:51:52.388 T1[60533:1070729] ENTER Microsoft.Maui.Controls.VerticalStackLayout
2023-08-22 16:51:52.388 T1[60533:1070729] Set Content
2023-08-22 16:51:52.420 T1[60533:1070729] Camera FaceTime HD-Kamera stop AccessError
Thread started:  #18
Thread started: <Thread Pool> #19
2023-08-22 16:51:52.443 T1[60533:1070729] Camera FaceTime HD-Kamera stop AccessError
2023-08-22 16:51:52.443 T1[60533:1070729] Camera FaceTime HD-Kamera stop AccessError
2023-08-22 16:51:52.445 T1[60533:1070729] Camera FaceTime HD-Kamera stop AccessError
2023-08-22 16:51:52.445 T1[60533:1070729] Camera FaceTime HD-Kamera stop AccessError

Solution

The problem is absent, if StartCamera is not called immediately after the CamerasLoaded - Event.

2023-08-24 10:56:22.455 T1[31472:2053909] ENTER T1.CameraAssistantView
2023-08-24 10:56:22.455 T1[31472:2053909] Set Content
2023-08-24 10:56:27.693 T1[31472:2053909] CamerasLoaded
Thread started: <Thread Pool> #11
Thread started:  #12
Thread started:  #13
Thread started:  #14
2023-08-24 10:56:35.343 T1[31472:2053909] Camera FaceTime HD-Kamera start Success
Thread started:  #15
2023-08-24 10:56:41.504 T1[31472:2053909] LEAVE T1.CameraAssistantView
2023-08-24 10:56:41.512 T1[31472:2053909] ENTER Microsoft.Maui.Controls.VerticalStackLayout
2023-08-24 10:56:41.512 T1[31472:2053909] Set Content
2023-08-24 10:56:41.576 T1[31472:2053909] Camera FaceTime HD-Kamera stop Success

t1's People

Contributors

fhintsch avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.