Fixing a face in the frame#
In LUNA ID, you can implement an event (in LUNA ID for Android) or timeout (in LUNA ID for iOS) which will react to the appearance of a face in the frame for further processing.
In LUNA ID for Android#
The LunaID.Event.FaceFound
event is triggered when LUNA ID detects a face in the frame for the first time and is used for further image processing.
Below is a usage example:
LunaID.allEvents()
.flowOn(Dispatchers.IO)
.flowWithLifecycle(viewLifecycleOwner.lifecycle, Lifecycle.State.STARTED)
.onEach {
if(it is LunaID.Event.FaceFound){
Toast.makeText(this.activity, "FaceFound", Toast.LENGTH_SHORT).show()
}
}
.flowOn(Dispatchers.Main)
.launchIn(viewLifecycleOwner.lifecycleScope)
In LUNA ID for iOS#
After a video session starts, LUNA ID waits for a face to appear in the frame for further processing. You can set a timeout, in seconds, within which the face should appear in the frame. If the face does not appear in the frame after this timeout, the session will be terminated with the 1028 error.
To set the timeout, use the LCLunaConfiguration.emptyFrameTime
property.
The default value is 0.