aws-samples/amazon-ivs-broadcast-android-sample

CustomSourceActivity front camera mirroring issue

Opened this issue · 6 comments

Emefar commented

Hello,

We are currently using the IVS-Broadcast library for our project and we're using CustomSourceActivity. I mean CameraManager. But front camera is mirroring, how can i fix this?

Thank you.

Hey @Emefar, do you mean the ImagePreview for the front camera is mirrored horizontally? If so, you can change this by calling setMirrored(false).

Emefar commented

I tried setMirrored(false) but nothing happened. I tried this on CustomSourceActivity

viewModel.preview.observe(this) {
     Log.d(TAG, "Texture view changed: $it")
     binding.previewView.addView(it)
     imagePreviewView = it
     imagePreviewView?.setMirrored(false)
}

Hey @Emefar, sorry, I missed that you were using a custom image source. In CustomSourceActivity, we are using a custom image source, so by default its preview is not mirrored. The custom image source doesn't keep track of the fact that the video is from the front camera, so treats it as any other video.

In order to flip, we would call setMirrored(true).

Emefar commented

@dang-tommy Thank you a lot. Worked!

Emefar commented

Hello again,

Unfortunatelly, i missed something. When i call setMirrored(true) front camera is working perfectly on broadcaster side. But all viewers seeing mirrored version. I mean, nothing changed on viewers (player) side.

Hey @Emefar, sorry for the late response. We recently validated a solution for this: using negative sizes in BroadcastConfiguration.Mixer.Slot.setSize will help you mirror in the broadcast. More information on the mixer in this guide and an example in this repo in MixerViewModel.kt

Please give that a try and let us know whether that resolves your issue. Thank you!