Last active
July 18, 2025 06:17
-
-
Save arulwastaken/46927be5caea7b65f3deda880964e37a to your computer and use it in GitHub Desktop.
/commonMain/common/Camera.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class CameraEvent { | |
object Init : CameraEvent() | |
object CaptureImage : CameraEvent() | |
object SwitchCamera : CameraEvent() | |
} | |
abstract class CameraCallback { | |
private val _event = Channel<CameraEvent>() | |
val eventFlow: Flow<CameraEvent> get() = _event.receiveAsFlow() | |
suspend fun sendEvent(event: CameraEvent) { | |
this._event.send(event) | |
} | |
abstract fun onCaptureImage(image: Path?) | |
} | |
@Composable | |
expect fun CameraView(callback: CameraCallback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment