Skip to content

correct video orientation in fixed portrait app #2011

@myousefi1368

Description

@myousefi1368

hi.
i dont want to use android:screenOrientation="sensor" because i want to use only one layout for my activity and only rotate icons programmatically in the class.
i can get correct phone orientation state by onSensorChanged method and handle icon rotation works good.
but i cant get landscape video output from stream anyway. i try many ways but no success!
could you help me please?

orientationHelper.currentOrientation.observe(this) { orientation ->
      if (lastOrientation != orientation) {
        lastOrientation = orientation
        rotateIconsOnly(orientation)
        val rotationAngle = OrientationHelper.getRotationAngle(orientation).toInt()
        viewModel.updateOrientation(rotationAngle)
        Log.d("MainActivity", "Orientation changed to: $orientation, Angle: $rotationAngle")
    }
}

in lanscape mode the value of rotationAngle is 270 in my app:
Phone camera start stream using rotation: 270 degrees w:640 - h:360
Phone camera RTP connection started: rtmp://80.191.242.19:1935/live/test
Phone camera RTP connection success

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions