Opening and closing the settings screen
Settings can be opened from both theMainScreen overlay and the PlayerScreen. MainScene listens to the openSettings field on both screens:
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_PCTinAppConstants.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).
safeAreaChanged fires, MainScene calls ApplySceneLayout() and re-layouts all active screens immediately.
Available actions
Channel refresh
Selecting Actualizar canales emitsrefreshChannelsRequested 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 emitslogoutRequested, which triggers OnLogoutRequested() in MainScene:
m.global, and navigates back to the login screen.
Main menu items
The settings menu is built dynamically byBuildMenuItems() 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 insource/utils/ServerManager.brs:
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 emitsapplyServerRequested to MainScene, which calls ApplyServerNow(). This:
- Saves the new server URL to the Registry under
lastServer. - Updates
m.global.activeServer. - Stops the current video stream.
- Clears auth and catalog state.
- Restarts the handshake flow against the new server, followed by auto-login and playlist load.
Testing a server
Selecting Probar conexión launches aServerProbeTask 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:
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.