Closed Emefar closed 8 months ago
Hey @Emefar , zoom using the SDK managed camera is something we have planned, but there is no timeline yet for that feature. The best workaround we can provide for now is to use a custom image source to manage the camera yourself. Then you will have full access to the native camera's APIs.
For an example, please see CustomSourceActivity
and CameraManager
in this repo. While we don't explicitly show how to zoom, it does show how to hook up camera2
to our SDK.
I hope this helps.
Hello, We need zoom functionality in our app too, can I ask is this feature going to be added soon?
@armanate @Emefar We just published the IVS Broadcast SDK 1.16.0-rc.1 for Android
https://central.sonatype.com/artifact/com.amazonaws/ivs-broadcast
implementation 'com.amazonaws:ivs-broadcast:1.16.0-rc.1'
The Camera Zoom API is included in this release.
Note that this is an "RC" release, so it will not be announced same as our "full" releases, and it may be less stable than the "full" releases (not intentionally of course, it did go through QA).
Now with that being said let's look at how to use the new API.
The docs are available here - https://aws.github.io/amazon-ivs-broadcast-docs/1.16.0-rc.1/android/com/amazonaws/ivs/broadcast/package-summary.html - you want to look at CameraSource
and you want Capabilities
and Options
classes.
First, use DeviceDiscovery
and find the camera - I'm sure your app is already doing that
val discovery = DeviceDiscovery(context)
val deviceList = discovery.listLocalDevices()
val cameraDevice = deviceList.find {
it.descriptor.type == Device.Descriptor.DeviceType.CAMERA &&
it.descriptor.position == Device.Descriptor.Position.FRONT
}
Second, this is new, typecast the camera Device
into CameraSource
val cameraSource = cameraDevice as CameraSource
Now we're ready to find out if the camera supports zoom
val capabilities = cameraSource.capabilities
if (capabilities.isZoomSupported) {
val maxZoomFactor = capabilities.maxZoomFactor
}
And finally once we know that the camera supports zoom and what the max supported zoom factor is, we can set it
val options = CameraSource.Options.Builder().
setZoomFactor(1.5f). // between 1.0 and maxZoomFactor
build()
cameraSource.setOptions(options)
You can set the zoom factor before you start capturing from the camera (i.e. before you get a preview for it) or when the camera is already capturing, in the latter case the SDK will apply the new options immediately.
We just released 1.16.0 "official stable" and the Camera Zoom API is there. There were no changes compared to 1.16.0-rc.1.
I'm closing this issue since the Zoom API is now provided. If you run into an issue using this API, please open a separate issue.
Hello,
We are currently using the IVS-Broadcast library for our project and we are wondering if it supports the ability to Zoom during broadcasts. If this feature is available, we would like to request a roadmap on how to implement it into our application.
Thank you.