This article describes how to display a dynamic message to a user on a screen when the user appears in the camera view. This is usually done on a tablet or Windows Surface device. It can also be done with the SAFR Desktop Client on a Mac or Windows PC with a connected monitor.
Below is an example of what can be done:
How it works
SAFR actions return a message to the Desktop Client or Mobile Client. That message can be either a fixed string or it can be dynamically populated with one or more tokens available in SAFR actions. When a user is recognized an event is generated. SAFR's action event listener, Actions Relay Event Service (ARES), receives that event and processes it. That processing may include a script you define. When ARES has completed processing the event, a message is returned to the client that generated the event. That message is then displayed on the client's screen according to the settings you specify in the Events and User Interface preferences on that device.
Video Tutorials
- Dynamic Message Video Tutorial.mp4
- Make message persistent.mp4
- Modifying Display and Hiding Controls.mp4
Configuring a Dynamic Message
Update Person Record
Populate the person record with the information you would like to display for each recognized person. You can do this manually through the GUI or you can populate person record fields dynamically at runtime using SAFR REST APIs.
The person record fields that have yellow arrows pointing at them below are available to SAFR actions.
- In addition Gender and Age are available to SAFR Actions but these are usually extracted from the event. Please note that if these fields are present in a person record then the detected gender and age are ignored and the Gender and/or Age values that are attached to the person record are used instead.
Configure SAFR Actions
Open SAFR Actions and fill it out as follows:
Replace the userId and userPwd fields with your username and password.
The message field can be a multi-line string. On Macs, use "Alt + Enter" to create a line break. On a Windows machine you'll need to edit the SAFRActions.config file (located at C:\Program Files\RealNetworks\SAFR\ares) and manually add a "\n" where you would like a new line.
One useful option you may find is to add a conditional reply which will let you respond with different messages types depending the situation. Following demonstrates conditionalReply:
In this example, conditional reply gets the response from the script in "actions > item1". The script can return -1, 0 or 1 and the appropriate reply will be triggered. Only these 3 values (-1, 0 or 1) are supported. The message corresponding to the value returned by the command is returned to the client (SAFR Desktop or SAFR Mobile). SAFR Mobile then displays that message with respective tokens filled in from event data.
In this example we assume that the person's row and section number were stored in the indicated fields of the person record. See next section for more details.
Adding Dynamic Text to Response Messages
You can add tokens to the message string which will be replaced by their values. Below are several examples of the available tokens.
Token | Meaning |
---|---|
#N | Full Name |
#F | First Name |
#U | Last Name |
#p | Validation phone |
#e | Validation email |
#H | Home location |
#t | personTags (comma separated list of personTags) |
#O | company |
#m | moniker |
#<d>m | moniker substring (delimited by white-space) |
See the SAFRActions.config documentation for a complete list of tokens.
Configure the Client
The final step is to update the Mobile Client or Desktop Client preferences to instruct it to display the messages returned. To do this, open the appropriate preferences menu on the device and update the following settings.
Events Preferences
In the Events Preferences tab, update the items highlighted in red below.
User Interface Preferences
Though not required, you may want to adjust the font size of the message using the Overlay Text Size setting on the User Interface Preferences tab.
Test the Dynamic Message
To test the dynamic message, do the following.
- Add your face image to the group that should trigger the dynamic message, if it isn't already included.
- Hide your face from a camera attached to a SAFR client.
- Reveal your face to the camera, and wait a couple seconds.
If the test is successful, you should see the dynamic message on the device's screen.
Troubleshooting
- Check the ARES log to see if there are any obvious errors. The ARES log is located here:
- On Windows: C:\Program Files\RealNetworks\SAFR\ares\logs
- On macOS: /Library/RealNetworks/SAFR/ares/logs
- On Linux: /opt//RealNetworks/SAFR/ares/logs
- Make sure you connected to same account in SAFR Actions that you did in your SAFR client.
- Make sure the visual processing mode you are in on the SAFR client has events enabled.