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

Accesing Stream State #229

Open
LBoullosa opened this issue Feb 9, 2024 · 1 comment
Open

Accesing Stream State #229

LBoullosa opened this issue Feb 9, 2024 · 1 comment

Comments

@LBoullosa
Copy link

Hi!,

Is there a way to get the stream state to know exactly is the camera is streaming, is closed or whatever state could exists?

I see this kind of messages in the log,

[CameraStateMachine] New public camera state CameraState{type=CLOSING, error=null} from CLOSING and null
[CameraStateMachine] Publishing new public camera state CameraState{type=CLOSING, error=null}
[Camera2CameraImpl] {Camera@558aa2d[id=0]} Resetting Capture Session
[Camera2CameraImpl] {Camera@558aa2d[id=0]} Releasing session in state CLOSING
[StreamStateObserver] Update Preview stream state to IDLE

Camera2CameraImpl] {Camera@558aa2d[id=0]} Transitioning camera internal state: CLOSING --> INITIALIZED
[CameraStateRegistry] Recalculating open cameras:
[CameraStateRegistry] Camera State
[CameraStateRegistry] -------------------------------------------------------------------
[CameraStateRegistry] Camera@558aa2d[id=0] CLOSED
[CameraStateRegistry] Camera@8f4cbae[id=1] UNKNOWN
[CameraStateRegistry] -------------------------------------------------------------------
[CameraStateRegistry] Open count: 0 (Max allowed: 1)
[CameraStateMachine] New public camera state CameraState{type=CLOSED, error=null} from CLOSED and null
[CameraStateMachine] Publishing new public camera state CameraState{type=CLOSED, error=null}

Thanks in advance,

@LBoullosa
Copy link
Author

I found a way, not too pretty but works. This needs to be done under platform code for android

while (platformView.PreviewStreamState.Value != PreviewView.StreamState.Streaming)
     await Task.Delay(200);

As a possible new feature could be published with have some events or something. This will be in the direction to avoid initialization failures due to concurrency/synchronicity natural issues when we want to integrate this great library with our apps.

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

1 participant