Skip to main content
The settings panel is a full-screen overlay that floats above the player. It provides access to display configuration, account actions, and a hidden server management panel for switching between backend profiles.

Opening and closing the settings screen

Settings can be opened from both the MainScreen overlay and the PlayerScreen. MainScene listens to the openSettings field on both screens:
When closed, MainScene restores focus to the overlay or the player depending on how settings was opened.

Safe area

The safe area margin compensates for TV overscan — some televisions crop the edges of the image. The setting is stored as a percentage (uiSafeMarginPct) and applied as an inset on all four sides of the design canvas.
  • Range: 0 % to 10 % (UI_SAFE_MARGIN_MIN_PCT / UI_SAFE_MARGIN_MAX_PCT in AppConstants.brs)
  • Default: 0 %
  • Adjustment: Left/Right arrow keys on the focused safe area row; each press moves by 1 %.
  • Persistence: Written to the Roku Registry under the key uiSafeMarginPct (REG_KEY_SAFE_MARGIN).
When safeAreaChanged fires, MainScene calls ApplySceneLayout() and re-layouts all active screens immediately.

Available actions

Channel refresh

Selecting Actualizar canales emits refreshChannelsRequested to MainScene, which re-runs the playlist task in "refreshCatalog" context. The channel list is re-downloaded and the player is updated to the refreshed channel at the same index (or by matching contentId if available). The settings panel is closed before the refresh starts.

Logout

Selecting Cerrar sesión emits logoutRequested, which triggers OnLogoutRequested() in MainScene:
This stops the player, clears saved credentials from the Roku Registry, clears the channel list and auth state from m.global, and navigates back to the login screen. The settings menu is built dynamically by BuildMenuItems() in SettingsScreen.brs. In the default main mode the menu contains:

Server management panel

The server panel is hidden by default. It is unlocked by pressing OK on the Acerca de GlobalTV item five times (SERVER_ADMIN_UNLOCK_TAPS = 5). Once unlocked, a Ver servidores item appears in the main menu.

Server modes

The settings screen has three internal modes:

Default server profiles

The default profiles are defined in source/utils/ServerManager.brs:
These correspond to the two entries in SERVER_LIST in AppConstants.brs. The "Local" profile is a LAN server on 172.17.11.2:3333; the "Publico" profile is the WAN endpoint at admin.globaltv.lat.

Applying a server

Selecting Aplicar ahora on a server profile emits applyServerRequested to MainScene, which calls ApplyServerNow(). This:
  1. Saves the new server URL to the Registry under lastServer.
  2. Updates m.global.activeServer.
  3. Stops the current video stream.
  4. Clears auth and catalog state.
  5. Restarts the handshake flow against the new server, followed by auto-login and playlist load.

Testing a server

Selecting Probar conexión launches a ServerProbeTask that calls GTV_PingServer() against the selected server’s /health endpoint and reports the result as a status message in the detail panel — without affecting the active session.

ServerManager: LAN vs WAN selection logic

When the app needs to find a reachable server (e.g., during handshake), GTV_ServerBuildAutoProbeList() builds an ordered probe sequence that always tries LAN servers before WAN servers:

SERVER_LAN_FORCE_RETRIES = 3

LAN servers appear in the probe list SERVER_LAN_FORCE_RETRIES times (default 3) before WAN servers are tried once. With the default profiles the probe order is:
This gives the LAN server three chances to respond before the app falls back to the public WAN endpoint — useful when the LAN server is temporarily slow or takes a moment to wake up.
Type inference (GTV_ServerInferType()) classifies any URL matching 172.17.*, 192.168.*, 10.*, or localhost as "lan". Everything else is classified as "wan".

Registry persistence

Settings data is written to the Roku Registry under the "GlobalTV" section (REG_SECTION): Server profiles are serialised with FormatJson() and deserialised with ParseJson() + GTV_SanitizeServerProfiles(), which validates and deduplicates each profile on load.
Deleting all server profiles from the panel is blocked — GTV_ServerCanDelete() returns false when only one profile remains. At least one server must always be present.