aws-samples / aws-samples/amazon-ivs-broadcast-android-sample
Issues with IVS Broadcast SDK on Android: Mirroring Not Working and Video Not Filling 1080x1920 Slot
- Dominant language
- Kotlin
- Stars
- 13
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Problem 1: Mirroring Function Not Working
Description:
The mirroring functionality is not being applied as expected. I used the sample code to rotate the video using `imageDevice.setRotation()`, but it has no effect on the output. The goal is to enable mirroring (horizontal flip) of the camera feed when `App.mirror` is true.
Code Snippet:
val session = App.broadcastSession ?: return
val available = BroadcastSession.listAvailableDevices(requireActivity())
.firstOrNull { it.type == [Device.Descriptor.DeviceType.CAMERA](http://device.descriptor.devicetype.camera/) }
Log.e("IVS", "available:$available")
available?.let { descriptor ->
val micDevice = session.attachDevice(descriptor) as? ImageDevice
if (micDevice != null) {
Log.e("IVS", " ImageDevice succ")
micDevice.setRotation(if (App.mirror) ImageDevice.Rotation.ROTATION_180 else ImageDevice.Rotation.ROTATION_0)
} else {
Log.e("IVS", "ImageDevice failed")
}
}
Problem 2: Resolution and Aspect Ratio Not Filling the Screen
Description:
I configured the `BroadcastConfiguration` with a resolution of 1080x1920 and set `slot.aspect = BroadcastConfiguration.AspectMode.FILL`, expecting the video to fill the entire slot without black bars. However, the video still shows black bars at the top and bottom, indicating it’s not filling the specified area.
Code Snippet:
builder.mixer.slots = arrayOf(
BroadcastConfiguration.Mixer.Slot.with { slot ->
slot.preferredVideoInput = [Device.Descriptor.DeviceType.CAMERA](http://device.descriptor.devicetype.camera/) // Use default camera video source
slot.aspect = BroadcastConfiguration.AspectMode.FILL
slot.setSize(1080, 1920)
slot.position = BroadcastConfiguration.Vec2(0f, 0f)
[slot.name](http://slot.name/) = "camera"
return@with slot
}
)
Request for Assistance
I need help understanding why:
1. The mirroring effect isn’t working with `setRotation()`, and how to correctly implement mirroring for the camera feed.
2. The video doesn’t fill the 1080x1920 slot despite using `AspectMode.FILL`, and how to eliminate the black bars.
Please provide solutions or explanations based on the Android platform and the IVS Broadcast SDK.
Contributor guide
Research direction
Start with the Android sample code that attaches the camera through BroadcastSession and configures BroadcastConfiguration.Mixer.Slot. Reproduce both behaviors with ImageDevice.setRotation() and AspectMode.FILL using the 1080x1920 slot, then consult the IVS Broadcast SDK behavior for camera mirroring and aspect handling. Done means the camera feed mirrors when requested and fills the slot without the reported black bars.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- audio-video-rtc, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100