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

MIT No Attribution
9 stars 8 forks source link

CustomSourceActivity front camera mirroring issue #43

Open Emefar opened 11 months ago

Emefar commented 11 months ago

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.

dang-tommy commented 11 months ago

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 11 months ago

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)
}
dang-tommy commented 11 months ago

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 11 months ago

@dang-tommy Thank you a lot. Worked!

Emefar commented 10 months ago

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.

dang-tommy commented 10 months ago

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!