Rotate camera if player is about to go out of its view?

No one answers because the answer is too simple and only requires math education.
Get the rotation vector and rotate if the vectors mins/maxs are out of the desired bounds.

With blueprints its simply use the (Not Equal) node:

Here is my full blueprint which tells you if an actor is out of the camera’s bounds:

Also you have to use the Set Control Rotation node to set the rotation or your character won’t move? But it depends on your setup!