Global Settings

Allow users to adjust settings like camera and audio toggles

Overview

Sometimes Audience members just want to relax and play your module instead of being on camera. Sometimes we even let them!

Oooh handles this nicely for users within your module via our Pause Menu's Camera, Microphone and Audio Toggles, and normally requires no knowledge of the state of these settings on your part. This page covers how handle changes to these settings if your module needs to behaviour differently when they are toggled.

Reminder: Don't forget to properly set up your o3hmanifest Configuration or the SystemSettingsService will question the nature of reality and probably also not work correctly.

Usage

Subscribing for Updates

See: SystemSettingsService.getSystemSettingsUpdatesV2().

getSystemSettingsUpdateV2 is an event. Subscribe to it for updates to the user's preferences if your module's flows depend on whether the user has their Camera, Microphone or Audio enabled. Do this early in your initialization flow.

When you initially subscribe, you should receive the user's current SystemSettingsStates values.

settingsService = runtime.getSystemSettingsService();
settingsServiceUpdates = settingsService.getSystemSettingsUpdatesV2();
settingsServiceUpdates.subscribe(
   (onSettingsUpdated) => {
      cameraEnabled = onSettingsUpdated.CameraEnabled;
      micEnabled = onSettingsUpdated.MicEnabled;
      audioEnabled = onSettingsUpdated.AudioEnabled;
   });

Getting the initial camera and microphone state

If you need to find out if the camera or microphone are enabled at the start of your module, simply follow the same steps above to subscribe for updates. As soon as you subscribe, the first event will tell you the current state. The initial event is dispatched automatically when you subscribe, without the user taking any action. Because of this, you don't need any special code to deal with the initial values.