Camera Follow the player with deadzone

Hi friends!
I’m using a camera to follow the player. So the player is always in the center of the screen.
But when the player gets close to the map edge, the camera keeps following him.
I want it to recognize that the player is near the edge of the screen and stop following when it happens.

The way I manage to do it is something like that in the update function(checking both Y and X coordinates of the player):

if( player.x <= value) camera.scrollX = fixedValue

But I’m looking at the API documentation, and I have seen things like:
setDeadzone and useBounds.

I try to use them, but no luck at all.
There is a default way for me to do that? The camera follows the player, but not show the black bars(that does not belong to the map)?

OBS: The camera supposes to follow the player, but stops when the red line is rendered on the screen. So it will not show the black bars(painted on green).
img

Set camera bounds.

After some testing, I manage to do it with the setBounds method!
I was making the mistake to use the screen size for the bounds when I should use the map size.
Thanks, @samme!
How can I close the topic(or request to close)?