Skip to content

Conversation

zde-nekz
Copy link

@zde-nekz zde-nekz commented May 29, 2024

🎯 Goal

Enable turning on camera torch

✍️ Explain examples

override fun switchTorch(
        on: Boolean,
        completion: ((Boolean) -> Unit)?
    ) {
        Timber.d("Changing torch to on=$on")

        cameraCapturer.torch(
            on,
            object : CameraVideoCapturer.TorchHandler {
                override fun onTorchSuccess() {
                    Timber.d("Torch successfully turned on")
                    completion?.invoke(true)
                }

                override fun onTorchError(error: String?) {
                    Timber.d("Turning torch on failed: $error")
                    completion?.invoke(false)
                }

                override fun onTorchUnsupported() {
                    Timber.d("Turning torch on failed: unsupported")
                    completion?.invoke(false)
                }
            }
        )
    }

@zde-nekz zde-nekz requested a review from skydoves as a code owner May 29, 2024 08:45
@skydoves
Copy link
Contributor

skydoves commented Jun 7, 2024

Hi @zde-nekz, sorry for the delayed response. You can create this PR to the GetStream/webrtc repository, as this repository mirrors the native code from it. Once you re-create a PR to the webrtc repository, we will kindly review your PR again soon. Thank you!

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

Successfully merging this pull request may close these issues.

2 participants