The channel system in Television Simulator ‘99 is built for extension. Every watchable channel is a JavaScript class that inherits from the sharedDocumentation 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.
Channel base class, paired with an HTML layout file that gets loaded on demand into the screen div. Adding your own channel means creating a directory, writing a layout and a class, then registering the class in two places — index.html and tv.js.
Create the channel directory
Channel directories live under
channels/ and must be named with the channel number zero-padded to three digits:The directory must always use a zero-padded three-digit name regardless of the actual channel number. Channel 5 →
channels/005/, channel 42 → channels/042/. This is enforced by Helpers.padLeft(number, 3) inside tv.js’s showChannel() method.Create layout.html
layout.html is the HTML fragment loaded into the .current-channel div via jQuery’s .load() call when a viewer switches to your channel. It should contain every DOM element your channel class will manipulate: a YouTube player target, info panels, or any other layout you want to render inside the TV screen.id="ytplayer" div is the mount point for the YouTube IFrame API. The .current-channel div also receives the id attribute ch-{number} (e.g. ch-5) automatically when the channel loads, so your SCSS can scope styles to it.Create script.js — the channel class
Each channel is a class that Replace
extends Channel. The constructor chains to super(), show() is called once the layout HTML has been injected, and teardown() is called before any channel switch. Below is a complete working example for channel 5:'YOUR_VIDEO_ID' with the 11-character YouTube video ID you want to play on this channel.The class name must follow the pattern
Channel{number}, matching the channel’s number attribute in guide.xml exactly. Channel number 5 → Channel5. The TV core constructs the class dynamically via new this.classes['Channel' + number](...), so a mismatch will throw a runtime error.Load the script in index.html
Channel scripts must be loaded before The existing
js/core/tv.js so the class is defined when the TV initialises. Open index.html and add your script tag in the channel scripts block:channels/012/script.js line shows exactly where to add it.Register the class in tv.js
Open This is the registry the TV uses to instantiate the correct class when
js/core/tv.js and add your new class to the this.classes object inside the TV constructor:showChannel() is called. Every channel class you write must appear here.Add the channel to guide.xml
For your channel to appear in the listings grid and be switchable, add a Omitting
<channel> element with the watchable attribute to data/guide.xml:watchable means the channel row still appears in the guide table but the TV will not attempt to load it when the number is dialled. See Customizing Channel Listings for full details on the XML schema.Channel lifecycle
When a viewer switches to your channel, the TV runs three methods in sequence:| Method | When it’s called | What to do here |
|---|---|---|
show() | Immediately after layout.html is injected into the DOM | Initialise the YouTube player, set up DOM references, start intervals |
ready() | After the fade-in animation completes (warmupTime ms on first load, warmupTime / 10 on subsequent switches) | Start any animations or interactions that should only begin once the screen is fully visible. Must be defined on every subclass — the base Channel class does not provide this method and tv.js always calls it. |
teardown() | Before loading a different channel | Stop timers, stop playback — handled automatically by super.teardown() if you use this.timeouts and this.intervals |
super.show() at the start of show() and super.teardown() at the end of teardown(). The base teardown() in channel.js clears all registered timeouts and intervals, stops the YouTube player, and empties the container: