m.global. The node is populated once during startup by GTV_InitGlobalState() in source/AppState.brs.
Initialisation
MainScene.init() is the first code that runs on the render thread. Its first action is calling GTV_InitGlobalState():
addFields registers every key on the global node so that any component can observe or write to them.
Observing global fields
Components usem.global.observeField() to react to state changes without polling:
Because
m.global is a SceneGraph node, field writes and observer callbacks are always dispatched on the render thread regardless of which task triggered the write.Field reference
Network
Base URL of the currently active backend server (e.g.
"https://admin.globaltv.lat"). Set by MainScene after a successful handshake or server switch from Settings. Read by all task nodes to build API request URLs.Realtime update strategy. Currently always
"polling". Reserved for future server-push modes.Whether the device has a network interface that appears up. Set by
ConnectivityTask and reset to true by MarkSessionNetworkHealthy() after any successful API call.Whether the device can reach the internet (DNS / HTTP reachability). Distinct from
isOnline to allow distinguishing LAN-only from full connectivity. Set by ConnectivityTask.Auth
true after a successful auth response from AuthTask. Cleared to false by ClearSessionCatalogState() on logout or session expiry.Authenticated username. Written by
MainScene from LoginScreen.loginResult or from saved registry credentials during auto-login.Roku account email obtained via the on-device auth flow (
getUserData). Empty string when the user declines or the flow is skipped.Backend user ID returned by the auth endpoint. Cleared on logout.
true when the backend reports the subscriber’s account is active. Used by auth failure classification to distinguish inactive-account errors from credential errors.Human-readable reason string for an inactive or suspended account, sourced from the backend response. Displayed in
UserInactiveDialog.One-time notice message shown on the login screen after a forced logout (e.g. password changed). Cleared after display.
Numeric failure reason code. Values are defined in
AppConstants():| Value | Constant | Meaning |
|---|---|---|
0 | AUTH_REASON_NONE | No error |
401 | AUTH_REASON_CREDENTIALS | Wrong username or password |
460 | AUTH_REASON_NETWORK_DOWN | Network unreachable |
470 | AUTH_REASON_INACTIVE | Account inactive |
471 | AUTH_REASON_PASSWORD_CHANGED | Password changed remotely |
Channels
Array of channel objects built by
PlaylistTask from the M3U8 playlist. Each object contains at minimum contentId, stream URL, and metadata. Cleared on logout.Array of category objects grouping channels for the
MainScreen grid. Built alongside channelList by PlaylistTask.Flat index into
channelList for the channel currently loaded in PlayerScreen. Written by PlayerScreen when playback starts or changes.contentId of the channel currently loaded in PlayerScreen. Used by RunPlaylistRefresh() to restore the same channel after a catalog refresh.The channel index that the overlay cursor is on.
-1 means no explicit selection. Read by MainScene to sync focus when the overlay is opened.true when the user has manually navigated within the overlay (away from the auto-synced position). Controls whether OnRequestOverlay() restores a saved category/row position or re-syncs to the playing channel.Category tab index saved when the overlay is dismissed with a manual context. Restored on the next overlay open when
overlayHasManualContext is true.Row index within the selected category saved when the overlay is dismissed.
-1 means no saved row.Player
Current playback state string. Expected values:
"stopped", "buffering", "playing", "error". Written by PlayerScreen; read by ad and overlay components.true while MainScreen is visible in overlay mode on top of the player. Written by SetOverlayActive() in MainScene. Components can observe this field to pause non-critical work while the overlay is up.Ads
Monotonically-incrementing version counter for the active ad snapshot.
AdsPollingTask increments this when a new ad payload is available, triggering observers in AdManager.Unix timestamp (seconds) of the next scheduled ad poll. Written by
AdsPollingTask after each successful check. A value of 0 means check immediately.Device
Roku device serial number or equivalent unique identifier. Populated during the handshake / device-info collection phase.
Roku model string (e.g.
"4800X"). Sent to the backend in metrics and handshake payloads.Roku OS version string. Sent to the backend for compatibility tracking.
Roku ID for Advertisers (RIDA). Used by the ads subsystem for targeting. Respects the user’s limit-ad-tracking (LAT) preference.
true when the user has enabled Limit Ad Tracking on their Roku device. When true, rida must not be used for behavioural targeting.Device external IP address. Collected during handshake and included in ad-targeting parameters.
Device timezone offset in seconds from UTC. Used for time-sensitive ad scheduling.
Deep links
Raw deep-link payload from a cold-start launch. Written by
main.brs when args contains mediaType=live. Triggers the onLaunchDeepLink observer in MainScene, which stores it as m.pendingDeepLink until the channel list is available.Raw deep-link payload from a warm-start input event. Written by
main.brs when an roInputEvent contains mediaType=live. Triggers the onInputDeepLink observer in MainScene.Lifecycle
true after the AppLaunchComplete beacon has been sent to the Roku platform. Set by MainScreen once the channel grid has rendered. Prevents duplicate beacons on playlist refresh or channel switch.Writing patterns
MainScene is the primary writer for most fields. Other components write only the fields they own: