How clockley/ejaxmediasystem works
1. Overall shape
- This is an Electron desktop application with a dual-window architecture: one window is the operator/control surface, and a separate window is the clean presentation surface shown on the selected display.
2. Electron process boundary
- The top-level Node/Electron entry point is likely src/app.js, which coordinates window creation, lifecycle, and IPC.
- The repo is split into main-process orchestration and renderer-side UI logic, with preload scripts bridging the two.
3. Control window
- The control/management UI appears to live in src/index.html + src/main.mjs + src/main.css.
- This window is where an operator selects media, configures playback, chooses the presentation display, and controls state such as looping or switching content.
4. Presentation window
- The dedicated output/display window is implemented by src/media.html + src/media.mjs with src/media_preload.js.
- Its job is to render the actual content cleanly, without the management controls, so it can be projected or shown on a second monitor.
5. Playback subsystem
- Media playback logic is separated into reusable modules such as src/streamPlayer.mjs and src/audioFx.mjs.
- The README’s feature set indicates support for local audio/video, images, and YouTube live streams, so this layer is the core media pipeline feeding the presentation window.
6. Content switching and display management
- src/switcher.js and src/settings.mjs suggest a small coordination layer for choosing the active display/window behavior and remembering configuration.
- src/queue_switch_dialog.html + src/queue_switch_dialog_preload.mjs implies there is a modal or helper UI for switching queued items or changing the active presentation target.
7. Bible/scripture subsystem
- The repo contains a separate bibleBackend/ directory with a Go module and a bundled SQLite database (bible-sqlite.db), which strongly suggests an embedded scripture lookup service or offline Bible data source.
- The src/Bible.mjs module likely consumes that data source and provides scripture text to the UI or presentation layer.
8. Go/WebAssembly asset
- src/main.wasm and src/wasm_exec.js indicate that at least part of the app’s logic is compiled to WebAssembly from Go and loaded by the Electron renderers.
- That means the app likely uses a mixed model: Electron/JavaScript for UI and a Go-derived WASM component for some domain logic or data access.
9. Preload and IPC boundary
- Preload files such as src/app_preload.mjs, src/help_preload.mjs, src/media_preload.js, and src/queue_switch_dialog_preload.mjs show a deliberate sandbox boundary between renderer code and Electron APIs.
- This is the main integration seam: UI modules talk to the main process through exposed preload APIs rather than direct Node access.
10. Auxiliary windows and docs
- src/help.html and src/about.html are separate static UI surfaces, likely opened as dialog-style windows.
- src/dev-profiler.mjs suggests development-time instrumentation or debugging support.
11. Static assets and presentation styling
- fonts/Adwaita/ and src/main.css show the UI has bundled fonts and custom styling, which matters because the presentation window must look polished and consistent across platforms.
12. Build and packaging
- The repo uses Yarn/Node tooling (package.json, .yarnrc.yml) and a Makefile/BUILD.md for build orchestration.
- build-scripts/embed-css.ps1 indicates a packaging step that embeds or transforms CSS for distribution.
- The GitHub Actions workflow is currently focused on linting (eslint.yml), implying CI checks code quality rather than running a full backend service.
13. Runtime and deployment model
- The application is cross-platform for Windows and Linux, distributed as an installer/AppImage per the README.
- At runtime, everything runs locally on the user’s machine: Electron windows, local playback, local settings, and the embedded Bible database/backend. External network use appears limited to features like YouTube live streaming.
14. How the data flows
- Operator input enters the control window → IPC/preload passes commands to the Electron main process → main process updates state and tells the media window what to render/play → media modules perform the actual playback/display.
- Bible/content data is likely fetched from the local Go/SQLite backend or WASM module and then injected into the presentation UI when needed.
Main entry points: app.js App main · media.mjs Media logic · main.mjs Control logic · index.html Control window
Components 21
Electron app
Main Electron runtime, renderer windows, and preload bridge.
- App main · Top-level Electron entry that creates windows, wires lifecycle, and coordinates IPC.
src/app.js - App bridge · Preload surface for the main control window.
src/app_preload.mjs - Control window · Operator-facing window for selecting media, displays, and playback state.
src/index.html - Control logic · Main control-window UI logic and state handling.
src/main.mjs - Control style · Styling for the operator window.
src/main.css - Display switcher · Coordinates active display selection and presentation-window behavior.
src/switcher.js - Settings · Persists and applies application configuration.
src/settings.mjs - Queue dialog · Auxiliary UI for queue switching or target changes.
src/queue_switch_dialog.html - Queue bridge · Preload bridge for the queue switch dialog.
src/queue_switch_dialog_preload.mjs
Playback
Media rendering and playback pipeline for the presentation surface.
- Media window · Clean presentation surface shown on the selected display.
src/media.html - Media logic · Renderer code for presentation-window behavior and content display.
src/media.mjs - Media bridge · Preload bridge for the presentation window.
src/media_preload.js - Stream player · Core media playback for local files and live streams.
src/streamPlayer.mjs - Audio FX · Audio effects and processing layer used by playback.
src/audioFx.mjs
Bible backend
Embedded scripture data source and lookup service.
- Bible module · Scripture lookup and presentation integration in the UI.
src/Bible.mjs - Bible backend · Embedded Go module backing Bible/data access.
bibleBackend/main.go - Bible DB · Bundled offline scripture database.
bibleBackend/bible-sqlite.db
Build assets
Tooling, packaging, fonts, and compiled runtime assets.
- WASM runtime · Compiled Go/WebAssembly asset loaded by the Electron renderers.
src/main.wasm - WASM exec · Go WebAssembly runtime support script.
src/wasm_exec.js - Build scripts · Packaging and asset-embedding automation.
build-scripts/embed-css.ps1 - Bundled fonts · Packaged UI fonts used for consistent cross-platform rendering.
fonts/Adwaita
Connections 24
- App main → App bridge: exposes APIs · Main process exposes controlled window APIs through preload.
- App main → Control window: creates · Creates the operator/control window.
- App main → Media window: creates · Creates the presentation window.
- App main → Queue dialog: opens · Opens the queue-switch helper dialog.
- App main → Display switcher: coordinates · Main process delegates display and window switching.
- App main → Settings: loads · Reads and applies persisted configuration.
- Control window → Control logic: implements · Control window markup is driven by its renderer logic.
- Control logic → App bridge: uses bridge · Control UI talks to Electron through preload APIs.
- Control logic → Display switcher: selects display · Operator actions update active display and window state.
- Control logic → Settings: updates · Control logic reads and writes settings.
- Control window → Control style: styled by · Operator surface uses bundled CSS.
- Queue dialog → Queue bridge: uses bridge · Dialog communicates with main process through preload.
- Media window → Media logic: implements · Presentation window markup is driven by renderer logic.
- Media logic → Media bridge: uses bridge · Presentation renderer uses a constrained preload API.
- Media logic → Stream player: plays · Media window delegates actual playback to the stream player.
- Media logic → Audio FX: processes audio · Playback can be shaped by audio effects.
- Media logic → Bible module: renders scripture · Bible content is surfaced in the presentation UI.
- Stream player → Audio FX: feeds · Playback engine passes audio through processing.
- Bible module → Bible backend: queries · Scripture module consumes the embedded backend.
- Bible backend → Bible DB: reads · Go backend is backed by the bundled SQLite data.
- Media logic → WASM runtime: loads · Renderer loads the Go-compiled WASM asset where needed.
- WASM runtime → WASM exec: requires · WASM asset depends on the Go runtime shim.
- Build scripts → Control style: packages · Build automation can embed or transform CSS for distribution.
- Build scripts → Bundled fonts: bundles · Packaging includes application fonts.