Is there any way to detect if the user's face leave outside the ARSCNView?

Hi, there, there is a face tracking feature with ARFaceTrackingConfiguration in my app. I'd like to know if there is any way to tell if the user's face leave outside the camera feed in the ARSCNView?

Well, here is my solution now:

declare a variable to store the time last face updated

private var lastFaceUpdateTime: TimeInterval?

update the time when the face updated:

func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
        guard let faceAnchor = anchors.first as? ARFaceAnchor else { return }
        lastFaceUpdateTime = session.currentFrame?.timestamp
    }

check if the face exist

func session(_ session: ARSession, didUpdate frame: ARFrame) {
        updateFaceDetectedState()
    }

func updateFaceDetectedState() {
        guard let lastFaceUpdateTime = lastFaceUpdateTime else {
            return
        }
        
        DispatchQueue.main.async {
            
            let currentTime = CACurrentMediaTime()
            let timeSinceLastUpdate = currentTime - lastFaceUpdateTime
            
            if timeSinceLastUpdate < 0.5 {
                print("Face is inside the scene view")
            } else {
               print("Face is outside the scene view")
            }
        }
        
    }
Is there any way to detect if the user's face leave outside the ARSCNView?
 
 
Q