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

Preview orientation sideways when rotating device #260

Closed
MaTriXy opened this issue May 31, 2018 · 1 comment
Closed

Preview orientation sideways when rotating device #260

MaTriXy opened this issue May 31, 2018 · 1 comment

Comments

@MaTriXy
Copy link

MaTriXy commented May 31, 2018

What are you trying to achieve or the steps to reproduce?

Have the preview view to show the front/rear camera and also rotate the device while doing so.
catching the onconfiguration change and setting the preview sizes to replace width and height.
didn't find a way to let the view know of the orientation

How did you initialize FA?

        fotoapparat = Fotoapparat(
                context = this,
                view = camera_view,
                focusView = focusView,
                logger = logcat(),
                lensPosition = activeCamera.lensPosition,
                cameraConfiguration = activeCamera.configuration,
                cameraErrorCallback = { Log.e("TAG", "Camera error: ", it) }
        )

private sealed class Camera(val lensPosition: LensPositionSelector, val configuration: CameraConfiguration) {

    object Back : Camera(
            lensPosition = back(),
            configuration = CameraConfiguration(
                    previewResolution = firstAvailable(
                            wideRatio(highestResolution()),
                            standardRatio(highestResolution())
                    ),
                    previewFpsRange = highestFps(),
                    flashMode = off(),
                    focusMode = firstAvailable(
                            continuousFocusPicture(),
                            autoFocus()
                    ),
                    frameProcessor = {

                    }
            )
    )

    object Front : Camera(
            lensPosition = front(),
            configuration = CameraConfiguration(
                    previewResolution = firstAvailable(
                            wideRatio(highestResolution()),
                            standardRatio(highestResolution())
                    ),
                    previewFpsRange = highestFps(),
                    flashMode = off(),
                    focusMode = firstAvailable(
                            fixed(),
                            autoFocus()
                    ),
                    frameProcessor = {

                    }
            )
    )
}



    override fun onConfigurationChanged(newConfig: Configuration) {
        super.onConfigurationChanged(newConfig)
        camera_view.layoutParams = ConstraintLayout.LayoutParams(camera_view.height, camera_view.width)
}

What was the result you received?

preview was rotated 90/270 degress

What did you expect?

preview will show properly on both orientations even while changing orientation.

Context:

  • FA version: 2.2.0
  • Devices/APIs affected: nexus 6p android 8.1 ,moto z android 7.1
@jordaorodolfo
Copy link

Occurence also confirmed on device Moto G 2013 ("Falcon"), running custom rom lineage OS 14.1, android 7.1; but in my case, I mostly stayed with the default options and followed the three get started points religiously. As a side note, if it helps, this same bug also happens in the same device and ROM with the library CameraView.

Diolor added a commit that referenced this issue Mar 2, 2019
Fixes #262
Fixes #260
Fixes #253
Fixes #193
@Diolor Diolor closed this as completed in 1783058 Mar 2, 2019
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

2 participants