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

Problem with displaying different video orientation? #523

Open
jgnt32 opened this issue Oct 17, 2024 · 0 comments
Open

Problem with displaying different video orientation? #523

jgnt32 opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jgnt32
Copy link

jgnt32 commented Oct 17, 2024

Hello
In my UI TextureRendererView was placed with MATCH_PARENT constraint so it fill whole space. I was trying to display on it video with different orientation using RendererCommon.ScalingType. What i mean: If video landscape and phone is portrait it has to be FIT inside view not FILL.

Frame 1

But its not possible because in issue 416 was said that i have to use WRAP_CONTENT constraint for min video side.
This mean that if i wanna fit video in TextureRendererView i need follow this algorithm:

  1. Detect video orientation
  2. Depend on video orientation set correct view layout params
  3. Add view as renderer in VideoTrack

Video dimensions is possible to get from TrackPublication.dimensions field. But there is problem with android LiveKit SDK:
when user change phone orientation dimensions not changing even if user turn video off and on again. IOS sdk doesn't have this problem - android receive event about changing opponent video with changed dimensions when IOS user rotate phone.

I was trying to change capture video params by calling this code but this not affect anything at all

fun processOrientationChanged(orientation: Int) {
  val track = room.localParticipant?.videoTrackPublications?.firstOrNull()?.first?.track
  val isPortrait = orientation == Configuration.ORIENTATION_PORTRAIT
  val width = if (isPortrait) VideoPreset169.H720.capture.height else VideoPreset169.H720.capture.width
  val height = if (isPortrait) VideoPreset169.H720.capture.width else VideoPreset169.H720.capture.height
  val capturer = (track as? LocalVideoTrack)?.capturer
  capturer?.changeCaptureFormat(width, height, VideoPreset169.H720.capture.maxFps)
}

I got missing something
Maybe there another way to get video dimensions
Please help

@jgnt32 jgnt32 added the bug Something isn't working label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant