Television client
The television client is an IPTVnator application for webOS and Samsung Tizen televisions. It lets viewers connect a TV to their own IPTV sources, browse and watch live TV, movies, and series, and resume viewing with a remote or pointer. A companion phone setup page reduces TV typing, while a trusted IPTVnator backend supports provider access, pairing, and optional shared source storage.
System boundary
The TV client owns the television viewing experience from backend connection and source setup through browsing, playback, guide use, favorites, metadata, and resume state. It runs as a separate TV-focused client rather than as a replacement for the main Electron/PWA player. The TV browsing and playback page covers the viewer flows in more detail.
TV application
The TV application presents source selection, Home, Live TV, Movies, Series, Favorites, Search, Settings, and title details as one remote-friendly experience. It keeps source choice, navigation, focus, playback, and saved viewing state together so a viewer can open a title or channel without changing clients. Its entry point supplies build identity to the feature boundary, loads the TV-specific viewing surfaces for each supported package, and includes the player styling for the next-item prompt. References: apps/…/main.tsx• L1-18, apps/…/PRODUCT.md• L16-29, apps/…/vite.config.ts• L9-45, libs/…/app.tsx• L28-43, libs/…/app.tsx• L200-253, apps/…/up-next.css• L7-24
TV platform packages
The client uses the same browser-based TV experience across supported television platforms, with a platform package that supplies the target device's launch and distribution rules. The webOS output remains a local-file browser bundle, while the Samsung package turns that bundle into a signed Tizen widget with TV input and network access. References: apps/…/vite.config.ts• L9-45, apps/…/package-tizen.mjs• L11-40, apps/…/config.xml• L5-26, apps/…/tizen-package.mjs• L16-43
Samsung TV package
The Samsung package is a Tizen TV application that launches the shared TV client in landscape mode and supports remote key input. Its package metadata identifies the Samsung TV profile, grants internet access, and points the device to the client page and shared icon. References: apps/…/config.xml• L2-26
Tizen package signing
Tizen distribution requires a local Samsung certificate profile. The package flow stages the TV bundle as a Tizen input, checks that it has the required platform shape, and asks the Tizen tool to produce one signed widget for distribution. References: apps/…/package-tizen.mjs• L6-40, apps/…/tizen-package.mjs• L16-43, apps/…/tizen-package.mjs• L46-121
Build identity
Each TV build carries a small identity record for the running application. The record connects the packaged app to its release metadata and source revision, and the same identity forms part of the build cache decision so a new revision or local source change does not silently reuse old TV output. References: apps/…/build-info.ts• L7-42, apps/…/build-info.d.ts• L1-4, apps/…/vite.config.ts• L9-12, apps/…/project.json• L11-19, apps/…/build-info.test.mjs• L35-95, apps/…/about.css• L1-51
IPTV source model
An IPTV source is a saved account or playlist that supplies live channels and, when supported, movies, series, and programme data. The TV client supports M3U, Xtream Codes, and Stalker/Ministra sources. IPTVnator supplies the player and connection path, not channels or subscriptions. References: apps/…/PRODUCT.md• L22-29, apps/…/PRODUCT.md• L37-43, libs/…/index.ts• L6-28
Provider capabilities
Provider types expose different parts of the TV experience. M3U supplies live channels and movies without series or programme data, while Xtream and Stalker can supply series and EPG data; Stalker also supports series found in its video-on-demand catalog. The TV uses these capabilities to show the content and guide features that a source can support. References: libs/…/m3u.ts• L17-23, libs/…/xtream.ts• L23-29, libs/…/stalker.ts• L31-38, libs/…/index.ts• L96-118
TV interaction model
The client is designed for directional remote navigation and pointer input at television viewing distance. A shared focus language marks the current control, separates selected state from focus, and keeps remote actions deliberate across cards, lists, grids, rails, and dialogs. Horizontal rails also support pointer scrolling without taking focus away from the content. References: apps/…/PRODUCT.md• L57-63, apps/…/PRODUCT.md• L87-92, apps/…/tokens.css• L1-6, apps/…/focus.css• L1-132, apps/…/horizontal-rail.css• L1-38, libs/…/horizontal-rail.tsx• L49-97
TV dialogs
Dialog surfaces keep selection, search, and long descriptions inside the current TV workflow. They support focused choice and readable scrolling without forcing a viewer to leave the page that owns the action. References: apps/…/dialog.css• L1-115, apps/…/theme.css• L553-563, apps/…/theme.css• L670-679
Title metadata
Optional TMDB metadata improves movie and series details without changing the provider item or its playback identity. It can add artwork, descriptions, year, genres, countries, duration, rating, credits, episode stills, and links to a person's filmography; provider data remains usable when the metadata service is disabled or unavailable. References: libs/…/tmdb.ts• L59-72, libs/…/tmdb.ts• L83-195, libs/…/detail.tsx• L43-95, libs/…/metadata-credits.tsx• L11-45, libs/…/detail-metadata.ts• L51-105
Backend connection
The backend is the TV's trusted home server and the normal path to IPTV providers. The TV checks that the selected service is a matching IPTVnator backend before it uses that service for provider access and playback URL resolution.
Backend discovery
The TV can select or configure a backend as an explicit user choice. A successful connection becomes the basis for source setup and later catalog access. The backend is required for the TV workflow, while native stream support still depends on the device and provider. References: apps/…/PRODUCT.md• L34-43, apps/…/theme.css• L1254-1295
Provider access
The backend gives the TV a common path to supported IPTV provider contracts. The TV uses the resulting catalog data and resolved stream address for browsing and native television playback. This keeps provider-specific access behind the backend while the TV client focuses on remote viewing. References: apps/…/PRODUCT.md• L27-30, apps/…/PRODUCT.md• L47-55, libs/…/use-tv.ts• L61-89
Catalog and playback data
Each provider turns its source into a shared catalog shape for channels, movies, series, episodes, and programme entries. The TV can then search, filter by named category, open details, load episodes, read EPG data, and request a playable stream without exposing provider-specific records to the viewing screens. References: libs/…/m3u.ts• L38-98, libs/…/xtream.ts• L72-238, libs/…/stalker.ts• L97-270, libs/…/index.ts• L30-118
Media compatibility
The TV uses the device's native video adapter. A provider can return valid catalog data and still fail at playback when the TV cannot support the stream format or required media behavior. Browser checks do not certify the real television's codecs or native playback. References: apps/…/PRODUCT.md• L47-63, libs/…/native-player-view.tsx• L31-53, apps/…/theme.css• L1017-1037
Phone setup
The companion setup application is a small phone form served by the web backend. The TV starts a temporary setup session and shows a QR code; the phone uses that session to enter source or settings data, and the TV reviews the result before applying it.
Source pairing
Source pairing transfers source details so viewers do not need to type long provider values with a TV remote. The source remains part of the TV's configured viewing setup after the TV accepts the submitted data. References: apps/…/PRODUCT.md• L37-43, apps/…/settings.css• L73-100, apps/…/theme.css• L1296-1325
Settings pairing
Settings pairing extends the same phone-assisted setup idea to TV preferences. It keeps setup separate from normal viewing so the phone supports configuration without becoming a second playback client. References: apps/…/settings.css• L73-125, apps/…/theme.css• L1296-1325
Pairing lifecycle
The pairing flow moves from a TV-created setup session to phone entry, TV review, and a local TV change.
sequenceDiagram
participant TV
participant Backend
participant Phone
TV->>Backend: Create temporary setup session
Backend-->>TV: Return phone setup link
TV-->>Phone: Show QR code
Phone->>Backend: Submit source or settings data
TV->>Backend: Check setup session
Backend-->>TV: Return pending data
TV->>TV: Review and apply change
References: apps/…/settings.css• L73-125 apps/…/theme.css• L1296-1325 apps/…/PRODUCT.md• L39-43
Local TV data
The TV keeps the state needed for a personal viewing experience on the device. This includes configured sources, the active source, favorites, viewing history, resume positions, and TV preferences. Shared server sources do not imply shared viewing history or progress. References: apps/…/PRODUCT.md• L49-55, apps/…/PRODUCT.md• L81-85, libs/…/index.ts• L134-161
Viewing state
Favorites, history, and resume positions stay local to the TV and remain tied to a source-aware media identity. Home, detail, episode, and player surfaces use the same watch state so progress words, progress bars, resume actions, and watched status agree. A title at the watched threshold leaves continuation lists, while explicit watch or reset actions change the local record without allowing an older player session to restore removed state. References: libs/…/hero.tsx• L31-109, libs/…/detail.tsx• L63-169, libs/…/native-player-view.tsx• L101-237, libs/…/watch-state.ts• L8-34, libs/…/watch-state.test.ts• L24-106, libs/…/favorites.tsx• L11-18
Series context
Episodes keep their own playback identity while retaining a snapshot of their parent series for saved details and resume flows. Series details present a season's episodes as a focused rail with per-episode progress and options, while the player can offer the next episode after the current one ends. This lets an episode opened from a favorite or history entry still show its series title, artwork, category, and other parent context. References: libs/…/index.ts• L45-52, libs/…/series-context.ts• L18-64, libs/…/series-context.ts• L66-93, libs/…/detail.tsx• L172-219, libs/…/episode-rail.tsx• L50-217, libs/…/native-player-view.tsx• L112-168, apps/…/up-next.css• L1-154
Settings workspace
Settings brings backend connection, source management, phone setup, EPG, layout, catalog sort, and optional TMDB metadata into one TV workspace. Its layout supports category-based navigation and a focused panel, while phone setup can open as a separate focused surface so configuration remains usable with a remote. References: apps/…/settings.css• L1-125, apps/…/theme.css• L1296-1325, libs/…/index.ts• L145-161
Shared source library
The optional server library lets the TV use source configurations stored by the backend. It is a source-sharing service rather than a viewing-state service, so it does not replace local favorites, history, resume positions, or TV preferences. References: apps/…/PRODUCT.md• L49-55, libs/…/index.ts• L126-133
Library choice
The viewer explicitly chooses whether to use backend selection and optional shared server sources. A shared source can simplify setup across supported clients, but the TV still owns its local viewing data. References: apps/…/PRODUCT.md• L34-43, apps/…/PRODUCT.md• L49-54
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the TV runtime, browser-only bundle contract, local file loading, and approved webOS and Samsung TV compatibility limits aligned with the entry point and platform package metadata.
- Keep the Tizen widget identity, required platform version, privileges, landscape mode, remote key input, and signed output aligned with Samsung TV launch needs.
- Keep the Tizen staging flow separate from the webOS package and exclude platform metadata that belongs only to the other target.
- Keep build metadata inputs, the identity passed to the TV feature boundary, the About surface, and the build cache key aligned when release or source state changes.
- Keep backend connection rules aligned with source setup and provider access. A TV can connect to a service but still lack native playback support.
- Keep provider capability flags aligned with catalog, episode, EPG, and playback behavior. A source may support live TV while not supporting series or programme data.
- Keep optional TMDB enrichment separate from provider identity and playback fields. Metadata failure must leave the provider title usable.
- Keep phone setup fields and TV review behavior aligned for both source and settings pairing.
- Preserve the boundary between shared source configuration and TV-local favorites, history, resume positions, and favorite source scope.
- Preserve source and media identity when enriching titles or restoring series context. Saved episodes must still resolve against their original source.
- Keep remote focus, selected state, Back behavior, horizontal rail scrolling, and deliberate playback behavior intact when changing navigation or layout.
- Keep watch-state rules, progress labels, continuation lists, manual watch actions, and stale-session protection aligned when changing playback state.
- Keep episode rail focus, season selection, episode descriptions, and next-episode actions aligned when changing series details or player behavior.
- Keep virtual collection windows and spacer dimensions aligned with focus restoration and scroll position for long catalogs and seasons.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The TV bundle includes a non-browser runtime dependency or keeps module-only loading in the packaged page | The webOS or Tizen app can fail before the viewing experience starts | Keep the build output browser-only and compatible with local file loading |
| The Samsung signing profile is missing or the Tizen package contains invalid platform metadata | The Samsung widget cannot be signed or installed | Use a local Tizen signing profile and validate the staged widget before packaging |
| Tizen staging keeps incompatible metadata or omits the Samsung SDK load | The package can fail validation or start without required TV support | Stage a target-specific widget and load the Samsung SDK before the application |
| Build identity ignores a new revision or local change outside the TV app | The package can reuse stale output or report the wrong source state | Include the workspace revision and modified state in the TV build identity and cache key |
| The TV uses a non-matching or unavailable backend | Source setup and provider access cannot proceed | Require a configured matching IPTVnator backend |
| A provider stream is not supported by the TV | Browsing can work while playback fails | Validate behavior on the target TV and use the native video adapter |
| A source advertises content that its provider capability does not support | The TV can offer an empty or unusable series or guide view | Use provider capabilities to gate content and guide behavior |
| TMDB is disabled, slow, or rejects its key | Detail pages lose enriched artwork or credits but should still open | Keep provider fields as the base and treat enrichment as optional |
| Phone setup data is not accepted by the TV | The intended source or setting is not applied | Keep phone entry, TV review, and local commit in one flow |
| A saved item loses its source or kind identity | The TV can open the wrong item or fail to resolve playback | Preserve source-aware media identities through enrichment and series context |
| Shared source data is treated as viewing-state data | Favorites, history, or resume behavior can change unexpectedly | Keep viewing state local to the TV |
| A focus style, selected-state rule, or rail control is changed without its shared focus contract | Remote users can lose the current item or confuse focus with selection | Keep focus, selected, disabled, and pointer-only states consistent across TV surfaces |
| A long catalog or season loses its stable window or spacer size | Focus can jump, scroll can move to the wrong place, or items can disappear while navigating | Preserve virtual collection and episode rail coordinates during loading and resize |
| Progress labels use a different position rule from the progress bar or an old player update wins | Viewers can see conflicting watch status or a deleted checkpoint can return | Derive display and continuation state from the shared watch rules and revision fence |
| The next-episode lookup or activation fails after an episode ends | The viewer cannot continue the series from the player | Keep the next-episode state visible with a retry path and a clear unavailable state |
Key files
| File | Why to read it |
|---|---|
| apps/…/PRODUCT.md | Product purpose, supported users, platform limits, and TV workflow |
| apps/…/AGENTS.md | TV runtime boundary, device-facing development context, and validation scope |
| apps/…/project.json | TV lifecycle targets and the cache input that tracks build identity |
| apps/…/build-info.ts | Release and source identity supplied to each TV build |
| apps/…/build-info.test.mjs | Contract that keeps build identity usable without Git and sensitive to source changes |
| apps/…/main.tsx | TV application entry point, top-level style boundary, and next-item player styling |
| apps/…/tokens.css | TV viewing scale, safe area, control size, and focus tokens |
| apps/…/focus.css | Shared focus and selected-state language for remote navigation |
| apps/…/vite.config.ts | TV bundle target, browser-only runtime checks, and packaged webOS loading contract |
| apps/…/package-tizen.mjs | Samsung TV packaging and signed widget output |
| apps/…/tizen-package.mjs | Tizen staging and package checks that protect the Samsung TV launch contract |
| apps/…/config.xml | Samsung TV widget identity, platform profile, permissions, and device settings |
| apps/…/about.css | Readable presentation for the TV application's identity and project details |
| apps/…/dialog.css | Focused selection, search, and description dialog presentation |
| apps/…/settings.css | Settings workspace and phone setup presentation |
| apps/…/theme.css | TV navigation, focus-independent layout, catalog, live layout, metadata, and native player presentation |
| apps/…/horizontal-rail.css | Pointer-friendly horizontal rail controls and safe-area spacing |
| apps/…/programme-guide.css | Programme guide layout and day, schedule, and details surfaces |
| apps/…/grid-guide.css | Grid guide layout for channel and programme time ranges |
| apps/…/live-overlay.css | Live channel, guide, and programme overlays over playback |
| apps/…/up-next.css | Next-item card, collapsed prompt, progress bar, and countdown presentation in the TV player |
| libs/…/app.tsx | Composition of TV navigation, catalog, detail, live, favorites, metadata, and player surfaces |
| libs/…/use-tv.ts | Shared TV state for source selection, catalog access, playback, navigation, and local data |
| libs/…/detail.tsx | Title actions, seasons, episode entry, watch state, and metadata presentation |
| libs/…/episode-rail.tsx | Series episode navigation, focus restoration, and long-season behavior |
| libs/…/favorites.tsx | Source scope and local favorite behavior |
| libs/…/native-player-view.tsx | Native playback controls, live tools, resume actions, and next-episode behavior |
| libs/…/watch-actions.tsx | Shared watched, reset, and start-over actions |
| libs/…/hero.tsx | Home continuation state and featured-title actions |
| libs/…/horizontal-rail.tsx | Shared horizontal rail scrolling and pointer controls |
| libs/…/virtual-collection.tsx | Large catalog rendering, scroll stability, and focus restoration |
| libs/…/watch-state.ts | Shared progress, watched, resume, and stale-session rules |
| libs/…/watch-state.test.ts | Guarantees for watch thresholds, progress wording, persistence, and stale updates |
| libs/…/xtream.ts | Xtream catalog, series, EPG, and stream behavior |
| libs/…/stalker.ts | Stalker catalog, series, EPG, and stream behavior |
| libs/…/m3u.ts | M3U playlist catalog and playback limits |
| libs/…/tmdb.ts | Optional title, episode, and person metadata enrichment |
| libs/…/detail-metadata.ts | Provider and TMDB metadata shown on title details |
| libs/…/series-context.ts | Parent-series context retained for episode data |
| docs/television-browsing-and-playback.md | Child page for browsing, guide, and playback behavior |