# mickey2266/aiostreamstvos architecture

> Architecture diagram of the GitHub repository mickey2266/aiostreamstvos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mickey2266/aiostreamstvos
- Repository: https://github.com/mickey2266/aiostreamstvos

## Overview

AIOStreams for Apple TV wraps the AIOStreams web app in a tvOS app, routes Siri Remote input and page messages through a native bridge, and plays video with AetherEngine. The central workflow is page playback commands → native player channel → engine playback → video, audio, and subtitles, with status returned to the page. The graph also shows search input, persistent web storage, picture-in-picture, and Top Shelf. Some subsystems are documented in the README or named in the source index; their internal wiring is shown only where that evidence supports it.

Main entry points: [`App/MainViewController.swift`](https://github.com/mickey2266/aiostreamstvos/blob/main/App/MainViewController.swift) (App coordinator), [`App/Web/BridgeScript.swift`](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/BridgeScript.swift) (Page bridge), [`App/Player/AetherPlayer.swift`](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/AetherPlayer.swift) (Aether player), [`App/Player/PlayerChannel.swift`](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/PlayerChannel.swift) (Player channel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_page["AIOStreams page<br/>[WebApp.swift]"]
  node_webview["Web view<br/>[AIOWebView.m]"]
  node_bridge["Page bridge<br/>[BridgeScript.swift]"]
  node_storage[("Web storage<br/>[WebStorage.swift]")]
end

subgraph group_app["tvOS application"]
  node_controller["App coordinator"]
  node_remote["Remote input<br/>[RemoteInput.swift]"]
  node_keyboard["Search keyboard"]
end

subgraph group_playback["Playback"]
  node_playerchannel["Player channel"]
  node_protocol["Player protocol"]
  node_player["Aether player<br/>[AetherPlayer.swift]"]
  node_engine["AetherEngine<br/>[AetherHost.swift]"]
  node_audio["Audio output<br/>[AudioOutput.swift]"]
  node_subtitles["Subtitle rendering"]
  node_ass["ASS renderer<br/>[AssRenderer.swift]"]
  node_subtitlefonts["Subtitle fonts"]
  node_pip["Picture in picture"]
end

subgraph group_tvfeatures["tvOS features"]
  node_topshelf["Top Shelf publisher<br/>[TopShelf.swift]"]
  node_topstore[("Top Shelf store")]
  node_extension["Top Shelf provider"]
end

node_viewer(("Viewer"))

node_viewer -->|"presses"| node_remote
node_remote -->|"sends keys"| node_page
node_page -->|"sends messages"| node_bridge
node_bridge -->|"routes messages"| node_controller
node_controller -->|"loads page"| node_webview
node_controller -->|"sends updates"| node_page
node_controller -->|"restores and saves"| node_storage
node_controller -->|"creates and routes"| node_playerchannel
node_controller -->|"shows"| node_keyboard
node_bridge -->|"opens for search"| node_keyboard
node_playerchannel -->|"validates commands"| node_protocol
node_playerchannel -->|"dispatches commands"| node_player
node_player -->|"controls playback"| node_engine
node_player -->|"configures output"| node_audio
node_player -->|"updates cues"| node_subtitles
node_subtitles -->|"renders ASS"| node_ass
node_subtitles -->|"uses fonts"| node_subtitlefonts
node_controller -->|"configures"| node_pip
node_bridge -->|"publishes watch-next"| node_topshelf
node_topshelf -->|"saves items"| node_topstore
node_extension -->|"reads items"| node_topstore

click node_page "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/WebApp.swift"
click node_webview "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/AIOWebView.m"
click node_bridge "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/BridgeScript.swift"
click node_storage "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/WebStorage.swift"
click node_controller "https://github.com/mickey2266/aiostreamstvos/blob/main/App/MainViewController.swift"
click node_remote "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Input/RemoteInput.swift"
click node_keyboard "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Input/SearchKeyboard.swift"
click node_playerchannel "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/PlayerChannel.swift"
click node_protocol "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/PlayerProtocol.swift"
click node_player "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/AetherPlayer.swift"
click node_engine "https://github.com/mickey2266/aiostreamstvos/blob/main/Packages/AetherHost/Sources/AetherHost/AetherHost.swift"
click node_audio "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/AudioOutput.swift"
click node_subtitles "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/SubtitleOverlay.swift"
click node_ass "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/AssRenderer.swift"
click node_subtitlefonts "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/SubtitleFonts.swift"
click node_pip "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/PictureInPicture.swift"
click node_topshelf "https://github.com/mickey2266/aiostreamstvos/blob/main/App/Support/TopShelf.swift"
click node_topstore "https://github.com/mickey2266/aiostreamstvos/blob/main/Shared/TopShelfStore.swift"
click node_extension "https://github.com/mickey2266/aiostreamstvos/blob/main/TopShelf/ContentProvider.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page,node_webview,node_bridge,node_storage,node_viewer toneBlue
class node_controller,node_remote,node_keyboard toneAmber
class node_playerchannel,node_protocol,node_player,node_engine,node_audio,node_subtitles,node_ass,node_subtitlefonts,node_pip toneMint
class node_topshelf,node_topstore,node_extension toneRose
```

## Components

### Web experience

- [AIOStreams page](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/WebApp.swift): `App/Web/WebApp.swift`
- [Web view](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/AIOWebView.m): `App/Web/AIOWebView.m`
- [Page bridge](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/BridgeScript.swift): `App/Web/BridgeScript.swift`
- [Web storage](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Web/WebStorage.swift): `App/Web/WebStorage.swift`

### tvOS application

- [App coordinator](https://github.com/mickey2266/aiostreamstvos/blob/main/App/MainViewController.swift): `App/MainViewController.swift`
- [Remote input](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Input/RemoteInput.swift): `App/Input/RemoteInput.swift`
- [Search keyboard](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Input/SearchKeyboard.swift): `App/Input/SearchKeyboard.swift`

### Playback

- [Player channel](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/PlayerChannel.swift): `App/Player/PlayerChannel.swift`
- [Player protocol](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/PlayerProtocol.swift): `App/Player/PlayerProtocol.swift`
- [Aether player](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/AetherPlayer.swift): `App/Player/AetherPlayer.swift`
- [AetherEngine](https://github.com/mickey2266/aiostreamstvos/blob/main/Packages/AetherHost/Sources/AetherHost/AetherHost.swift): `Packages/AetherHost/Sources/AetherHost/AetherHost.swift`
- [Audio output](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/AudioOutput.swift): `App/Player/AudioOutput.swift`
- [Subtitle rendering](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/SubtitleOverlay.swift): `App/Player/SubtitleOverlay.swift`
- [ASS renderer](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/AssRenderer.swift): `App/Player/AssRenderer.swift`
- [Subtitle fonts](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/SubtitleFonts.swift): `App/Player/SubtitleFonts.swift`
- [Picture in picture](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Player/PictureInPicture.swift): `App/Player/PictureInPicture.swift`

### tvOS features

- [Top Shelf publisher](https://github.com/mickey2266/aiostreamstvos/blob/main/App/Support/TopShelf.swift): `App/Support/TopShelf.swift`
- [Top Shelf store](https://github.com/mickey2266/aiostreamstvos/blob/main/Shared/TopShelfStore.swift): `Shared/TopShelfStore.swift`
- [Top Shelf provider](https://github.com/mickey2266/aiostreamstvos/blob/main/TopShelf/ContentProvider.swift): `TopShelf/ContentProvider.swift`

### Other components

- **Viewer**

## Connections

- Viewer → Remote input: presses (evidence: `README.md`)
- Remote input → AIOStreams page: sends keys (evidence: `README.md`)
- AIOStreams page → Page bridge: sends messages (evidence: `README.md`)
- Page bridge → App coordinator: routes messages (evidence: `README.md`)
- App coordinator → Web view: loads page (evidence: `App/MainViewController.swift`)
- App coordinator → AIOStreams page: sends updates (evidence: `README.md`)
- App coordinator → Web storage: restores and saves (evidence: `App/MainViewController.swift`)
- App coordinator → Player channel: creates and routes (evidence: `App/MainViewController.swift`)
- App coordinator → Search keyboard: shows (evidence: `App/MainViewController.swift`)
- Page bridge → Search keyboard: opens for search (evidence: `App/Web/BridgeScript.swift`)
- Player channel → Player protocol: validates commands (evidence: `App/Player/PlayerChannel.swift`)
- Player channel → Aether player: dispatches commands (evidence: `App/Player/PlayerChannel.swift`)
- Aether player → AetherEngine: controls playback (evidence: `App/Player/AetherPlayer.swift`)
- Aether player → Audio output: configures output (evidence: `App/Player/AetherPlayer.swift`)
- Aether player → Subtitle rendering: updates cues (evidence: `App/Player/AetherPlayer.swift`)
- Subtitle rendering → ASS renderer: renders ASS (evidence: `App/Player/SubtitleOverlay.swift`)
- Subtitle rendering → Subtitle fonts: uses fonts (evidence: `App/Player/SubtitleOverlay.swift`)
- App coordinator → Picture in picture: configures (evidence: `App/MainViewController.swift`)
- Page bridge → Top Shelf publisher: publishes watch-next (evidence: `App/MainViewController.swift`)
- Top Shelf publisher → Top Shelf store: saves items (evidence: `App/Support/TopShelf.swift`)
- Top Shelf provider → Top Shelf store: reads items (evidence: `TopShelf/ContentProvider.swift`)
