Remote Config
Remote config is the equivalent of settings for your game in PlaySafe. It allows you to adjust various parameters that affect how PlaySafe operates without requiring app updates.
This feature lets you dynamically control important operational aspects like audio processing parameters, helping you optimize performance and costs based on your specific game's needs.
Use Cases
The most common use case for Remote Config is configuring the sampling rate - the percentage of your player base's audio that is recorded and processed by PlaySafe:
- Setting a sampling rate of
1.0
means 100% of eligible users will have their audio processed - Setting a sampling rate of
0.1
means only 10% of eligible users will have their audio processed - Setting a sampling rate of
0
effectively turns off audio processing entirely
By adjusting this value, you can:
- Control costs: Process only a statistically significant subset of audio during normal operations
- Staged rollouts: Start with a small percentage and gradually increase as you validate your configuration
- Special events: Temporarily increase sampling during specific in-game events or tournaments
Another parameter configurable through Remote Config is the silence threshold, which determines how sensitive the system is to detecting audio that contains actual speech versus silence.
How Remote Config Works
The PlaySafe SDK automatically fetches your Remote Config settings when the PlaySafeManager
initializes. The values are retrieved from the PlaySafe backend and applied to the SDK's internal parameters.
- When
PlaySafeManager.Initialize()
is called, it triggers a remote config fetch - The SDK sends a request to the
/remote-config
endpoint with your App Key for authentication - The PlaySafe backend responds with your configured settings
- The SDK applies these settings to parameters like
_recordingIntermissionSeconds
and_silenceThreshold
This happens transparently, with no action required from your code beyond the standard initialization.
Configuration in Dashboard
Remote Config values are set in the PlaySafe Dashboard:
- Log in to your PlaySafe Dashboard
- Navigate to the Settings > Remote Config section
- Adjust the parameters as needed:
- Sampling Rate: Value between 0-1 (0% to 100%)
- Audio Silence Threshold: Sensitivity for silence detection
Technical Implementation Details
Currently, Remote Config is used internally by the PlaySafe SDK and doesn't expose a public API for developers. The PlaySafe team plans to make the Remote Config settings accessible through the PlaySafeManager
in future SDK versions.
Behind the scenes, the SDK uses the GetProductAIConfig()
coroutine to retrieve configuration from the server:
// Internal implementation in PlaySafeManager.cs
private IEnumerator GetProductAIConfig()
{
using (UnityWebRequest www = UnityWebRequest.Get(PlaysafeBaseURL + "/remote-config"))
{
www.SetRequestHeader("Authorization", "Bearer " + appKey);
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
{
ProcessRemoteConfig(www.downloadHandler.text);
}
}
}
When successful, the configuration affects several internal parameters:
// The sampling rate controls how frequently audio is processed
float samplingRate = Mathf.Clamp(config.SamplingRate, 0f, 1f);
_recordingIntermissionSeconds = samplingRate > 0.000001f
? Mathf.Max(0, (int)((RecordingDurationSeconds / samplingRate) - RecordingDurationSeconds))
: int.MaxValue;
// The silence threshold determines how quiet audio must be to be considered "silent"
_silenceThreshold = config.AudioSilenceThreshold;
The SDK intelligently calculates the _recordingIntermissionSeconds
(how long to wait between recordings) based on the sampling rate, ensuring that over time the percentage of processed audio matches your configured sampling rate.
Example:
- If
RecordingDurationSeconds
is 10 andSamplingRate
is 0.2 (20%) - Then
_recordingIntermissionSeconds
would be 40 - This means for every 50 seconds (10 recording + 40 waiting), we record for 10 seconds
- Result: 10/50 = 0.2 or 20% sampling rate
Note: If you need direct access to Remote Config settings in your game, please contact the PlaySafe team. Future SDK versions may include more developer-facing Remote Config functionality.