Replies: 2 comments 3 replies
-
Hello, I think that the problem is the zoom values. First of all, I recommend you use getZoom method to get the actual zoom value instead of set a random value. int iZoomLevel = rtmpCamera1.getZoom(); //get actual zoom
//change this to increase sensibility. You can calculate sensibility using getMin and getMax zoom values
int zoomStep = 1;
cameraZoomControls = findViewById(R.id.cameraZoomControls);
cameraZoomControls.setActivated(true);
cameraZoomControls.setIsZoomInEnabled(true);
cameraZoomControls.setIsZoomOutEnabled(true);
// Handle zoom-in click
cameraZoomControls.setOnZoomInClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
iZoomLevel = iZoomLevel + zoomStep;
//max zoom is the limit
if (iZoomLevel > rtmpCamera1.getMaxZoom()) iZoomLevel = rtmpCamera1.getMaxZoom();
rtmpCamera1.setZoom(iZoomLevel);
Toast.makeText(getApplicationContext(), "Zoom In Clicked!", Toast.LENGTH_SHORT).show();
}
});
// Handle Zoom Out Click
cameraZoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
iZoomLevel = iZoomLevel - zoomStep;
//min zoom is the limit
if (iZoomLevel < rtmpCamera1.getMinZoom()) iZoomLevel = rtmpCamera1.getMinZoom();
rtmpCamera1.setZoom(iZoomLevel);
Toast.makeText(getApplicationContext(), "Zoom Out Clicked!", Toast.LENGTH_SHORT).show();
}
}); |
Beta Was this translation helpful? Give feedback.
1 reply
-
Other alternative is use zoom gestures: mCameraView.setOnTouchListener((v, event) -> {
if (event.getPointerCount() > 1 && event.getAction() == MotionEvent.ACTION_MOVE) {
rtmpCamera1.setZoom(event);
}
return true;
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My code is like this
The problem I am facing when I click Zoom In button, immediately it is not zooming in, after few clicks it completely zoom In to Maximum level
When I click the Zoom Out button, it is not zooming out progressively, after few clicks it completely zoom out
Is there any alternate way for Zoom In / zoom out
I am using 2.4.7 version
implementation("com.github.pedroSG94:RootEncoder:2.4.7")
Beta Was this translation helpful? Give feedback.
All reactions