Skip to main content

Electron player

The Electron player runs Castmill as a desktop application on a computer connected to a screen, such as a small form factor PC or a Mac mini. It can run in kiosk mode, update itself from an update feed, and restart, reboot, or shut down the computer.

PropertyValue
Supported systemsmacOS and Linux
Package formatsDMG (macOS); AppImage, snap, and deb (Linux)
Device IDSHA-256 hash of the computer's MAC address

Features​

  • Offline cold start. The application and its cache are stored on the computer, so it can start without a network connection and play its last content.
  • Kiosk mode. Production builds open full screen in kiosk mode.
  • Maintenance. Restart app, quit, reboot, shut down, and application update. Reboot runs the system reboot command and shutdown runs poweroff, so the user that runs the player must be allowed to run them. In development builds, reboot, shutdown, and update are blocked.
  • Telemetry for the dashboard's Telemetry tab.
  • CSS rotation of the playback area when you set an orientation in the dashboard.

The player does not add itself to the system's startup items. Configure your operating system to start the player automatically when the screen's user logs in.

Configure the build​

Server address​

The server options are compiled into the shared @castmill/device package. Set them in packages/device/.env.local and rebuild that package before you build the Electron player:

VITE_PRODUCTION_BASE_URL=https://castmill.example.com
VITE_DEFAULT_BASE_URL=https://castmill.example.com
yarn workspace @castmill/device build

The variables and the selection order are the same as for the Android player. You can switch between the compiled server options from Settings > Server in the on-screen menu.

Application settings​

The Electron app reads .env.development for yarn dev and .env.production for packaged builds, both in packages/platforms/electron-player:

VariableDescriptionRequired
VITE_APP_TYPEApplication type reported to the dashboard, for example ElectronYes
VITE_KIOSKtrue to open in kiosk modeYes
VITE_FULLSCREENtrue to open full screenYes
VITE_GOOGLE_API_KEYGoogle API key with the Geolocation API enabled, used to report the device's locationNo
VITE_DEBUG_OVERLAYtrue to show the playback debug overlay at startupNo

The production file sets VITE_KIOSK=true and VITE_FULLSCREEN=true. Without VITE_GOOGLE_API_KEY the player works normally but cannot report its location.

Update feed​

CASTMILL_UPDATE_URL sets the update feed that installed players check for new versions. It is compiled in at build time and is required. The provided build scripts set it for you:

ScriptUpdate feed
build:staging:mac, build:staging:linuxhttps://updates.castmill.dev/electron
build:prod:mac, build:prod:linuxhttps://updates.castmill.io/electron
build:mac, build:linuxSame as the staging scripts

To use your own feed, set the variable when you call a build script:

CASTMILL_UPDATE_URL=https://updates.example.com/electron yarn build:prod:linux

The build scripts use POSIX shell syntax and do not run in Windows shells.

Build from source​

Run these commands from packages/platforms/electron-player after installing dependencies at the repository root with yarn install.

Run the player in development mode:

yarn dev

Build a package for distribution:

# macOS
yarn build:prod:mac

# Linux
yarn build:prod:linux

electron-builder writes the packages to dist/.

Install​

Install the package as usual for your system: open the DMG on macOS, or install the deb, snap, or AppImage on Linux. Start the player. It opens the Register Your Device screen with a pincode. Register it as described in Players overview.

Update the player​

Run Check for updates on the device's Maintenance tab in the dashboard, or Update App from the on-screen menu. The player checks its update feed, downloads a newer version if there is one, and then quits, installs it, and starts again. Playback stops while the update is installed.

The update feed is a static HTTPS location in the electron-updater generic format. For Linux, it must contain latest-linux.yml and the package that file references, typically an AppImage, plus an optional .zsync file for differential updates.

Platform notes​

  • To leave kiosk mode on a test machine, open the on-screen menu and select Quit App.
  • If the screen must be rotated as a whole, including the desktop, use the operating system's display settings and keep the dashboard orientation at 0 degrees to avoid rotating twice.
  • Disable screen blanking, sleep, and update prompts on the computer so they do not cover the player.