Documentation Index
Fetch the complete documentation index at: https://mintlify.com/zshall/program-guide/llms.txt
Use this file to discover all available pages before exploring further.
Helpers and YouTubeApi are static utility classes used throughout the simulator codebase. Neither class holds instance state — every method is static, so you call them directly on the class name without constructing an object. Helpers lives in js/helpers/helpers.js and provides general-purpose browser and string utilities. YouTubeApi lives in js/helpers/youtube-ctrl.js and wraps the YouTube IFrame API player methods used by channel implementations.
All methods on both
Helpers and YouTubeApi are static. You never call new Helpers() or new YouTubeApi() — always call Helpers.methodName() or YouTubeApi.methodName() directly.Helpers
Helpers.isMobile()
navigator.userAgent with a regular expression and returns the regex match result (truthy on a match, null otherwise).
isMobile().any() in TV.startUp() to conditionally add the .scanlines overlay and register the resize handler — both are skipped on mobile:
Helpers.padLeft(nr, n, str?)
nr to at least n characters using the pad character str. If the string representation of nr is already n characters or longer, it is returned unchanged.
The value to pad.
The minimum desired output length.
The pad character. Defaults to
'0' when omitted or undefined.padLeft in two places:
TV.showChannelbuilds the layout path:channels/${Helpers.padLeft(number, 3)}/layout.htmlTV.showChannelsets the channel-number overlay:Helpers.padLeft(number, 2)
Helpers.loadScript(scriptUrl)
<script> element into <head> and returns a Promise that resolves when the script fires its onload event, or rejects on error.
The fully-qualified URL of the script to load.
YouTubeApi.loadYouTubeAPI() calls this method internally. You can also use it directly when a channel needs to load a third-party library before its show() logic runs.
The
onerror handler in the source contains a bug: reject(Error('Error loading ' + globalName || scriptUrl)) references globalName, which is not defined in scope. Due to JavaScript operator precedence this evaluates as reject(Error('Error loading ' + undefined) || scriptUrl), so the rejection message will read 'Error loading undefined' rather than the script URL. The onload path is unaffected.YouTubeApi
YouTubeApi.loadYouTubeAPI()
Helpers.loadScript("https://www.youtube.com/iframe_api"). Called by TV.startUp() during initialization. When the script loads, the global onYouTubeIframeAPIReady callback fires automatically.
YouTubeApi.restartVideo(player)
stopVideo then playVideo on the player instance.
An initialized YouTube IFrame API player object.
YouTubeApi.stopVideo(player)
player.stopVideo(). Called by Channel.teardown() if this.player is set, ensuring the video stops when switching channels.
An initialized YouTube IFrame API player object.
YouTubeApi.toggleMuteVideo(player)
player.unMute(); otherwise calls player.mute(). Returns true if the player is now muted after the toggle, false if it is now unmuted.
An initialized YouTube IFrame API player object.
The return value is
!player.isMuted() evaluated after the toggle call. Because the YouTube IFrame API’s isMuted() can have a brief async lag, always use this.muted (stored in the TV instance) as the canonical mute state rather than querying the player directly.YouTubeApi.muteVideo(player)
player.mute().
An initialized YouTube IFrame API player object.
YouTubeApi.unmuteVideo(player)
player.unMute().
An initialized YouTube IFrame API player object.
Global Callback
onYouTubeIframeAPIReady()
TV.startUp() listens for the youtubeReady event via document.addEventListener('youtubeReady', ...) and uses it as the signal to fetch data/guide.xml and load the default channel. This decouples the guide data fetch from the script-load callback, keeping the TV class independent of the global function name.