How would I check if the player camera is looking away from an object?

I’ve been trying to figure out how one would figure out how to register when the object leaves the camera’s view (Like a horror game where when you look away, an event with audio triggers). Although I’m unsure how to go about it. I got two options that I know of, and I’d like to know how others approach this as I’m dead certain that I’m going about it incorrectly.

Option 1:
Raycast and register on walls/objects which are known to be out of sight(This would mean adjusting all the walls in a general radius to contain certain tags for every event, or scripts…, or layers…)

Option 2:
Calculate the player cameras rotation where the center would be placed on the object(Every update since when the player moves around the calculation would change), then compare it to the player’s actual rotation and when the player rotation goes out of pre-calculated bounds(Based off of the players distance + resolution? Resolution affects how wide or tall the camera is so…) it’d trigger the event.

Are there more practical options than these?

Well, simplest way is to check the angle between camera forward vector and the vector that is the direction from camera to some position. And use camera FOV as a threshold. If the angle between is more than camera FOV, than object might be out of the player’s view.

Transform objectThatShouldBeOutOfSight;
Vector3 directionToObject;

directionToObject = objectThatShouldBeOutOfSight.position - camera.transform.position;

if (Vector3.Angle(camera.transform.forward, directionToObject) > camera.fieldOfView)
    {
        ScaryBoo();
    }

There is an event called OnBecameInvisible which probably solves your issue.
However, this might trigger too early. Consider a perfectly oriented north player, aligned with the said interest object. Depending on the size of the target, by the time you rotate around 45 degrees heading east, it would already trigger, when a perfect “away” situation would be at 180 degrees. If this bothers you, you can combine the event with your second approach, customizing and determining the boundaries where your action will take place, and checking only when the object is not on screen.