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

You don’t have to know which direction: left or right. You have to know the rotation. And you know it, just rotate your camera using the output rotator, the one calculated from the 2 points.