Skip to content

nrkno/sofie-chef

Repository files navigation

Sofie Chef

This is the Chef application of the Sofie TV Automation System. It is a small Electron app, used to display web pages in fullscreen-, borderless- or usual windows.

The intended use to display HTML graphics, video, and camera inputs with low latency directly out to a TV studio screen.

General Sofie System Information


Installation

Windows & Linux: Download and install the latest release from Releases.

Usage

When the application first starts, a config.json-file is created in the users home catalog (on windows, that's C:\Users\MY_USER\AppData\Roaming\sofie-chef\sofie-chef\config.json).

To open the config.json-file, click CTRL+Alt+SHIFT+C.

When the config.json-file is edited, the application applies the changes instantly.

Most properties of the config.json-file are also automatically updated when moving or resizing the windows.

Keyboard Shortcuts

  • CTRL+Alt+SHIFT+F Toggles fullscreen for the current (or last) selected window
  • CTRL+Alt+SHIFT+I Toggles DevTools (console) for the current (or last) selected window
  • CTRL+Alt+SHIFT+C Opens the config file in the system default editor
  • CTRL+Alt+SHIFT+N Creates a new window
  • CTRL+Alt+SHIFT+W Closes and removes the window

Configuration

See config.ts

Tips for Running in Fullscreen Mode

Here are some tips for when you want to display something in fullscreen and want to avoid ANY overlays on top of the content (like popups).

General Tips

  • In the config file, set:
    {
    	"fullScreen": true, // Display in fullscreen
    	"onTop": true // Display on top of other windows (and popups when in fullscreen mode)
    }

When Using Windows

  • Put the fullscreen window on a non-main display. If the content is on the primary display, an accidental click on the Windows key will open the Windows Start menu which will display on top of the output.

APIs

Websocket API

See types here for messages over websocket: src/lib/api.ts

Rest API

The API is exposed by default on http://localhost:5270

Note: If apiKey is set in config.json, all requests must include ?apiKey=API_KEY

URL Parameters Description
GET /api/status Current status
PUT /api/playURL/:windowId Body parameters:
/** The URL to load */
url: string
/** Execute javascript in web player */
jsCode?: string
Display web page
PUT /api/restart/:windowId Reload the web player
PUT /api/stop/:windowId Stop and clear the web player
PUT /api/execute/:windowId Body parameters:
/*_ Javascript to execute in web player _/
jsCode: string
Execute javascript in web player
GET /api/list List windows
GET /api List API calls

For Developers

Getting Started

yarn dev # or npm run dev

Build Binary

yarn build:binary

For Web Pages Rendered in Sofie Chef

If needed, the web page rendered inside Sofie Chef can be made aware that they are running inside by looking at the userAgent.

if (window.navigator.userAgent.match('sofie-chef')) console.log("I'm running inside Sofie Chef!")

The web page can also report various statuses to the renderer:

if (window.reportChefStatus) {
	window.reportChefStatus('good')
	window.reportChefStatus('good', 'Nothing to see here')
	window.reportChefStatus('warning', "Unable to load the correct font, but I'll manage...")
	window.reportChefStatus('error', 'Unable to load the video XYZ')
}

API

When enabled via the apiPort-property in the config.json file, Sofie Chef exposes a HTTP REST and a Websockets API.

The HTTP REST API is exposed on the port apiPort. A list of methods can be found at localhost:apiPort/api.

The Websockets API is exposed on the port apiPort+1. A description of the data-interchange can be found here: api.ts

For Maintainers

Making a New Release

  1. yarn release
  2. Push the branch (and tag!) to GitHub
  3. Wait for the Github Action to finish building the binaries.
  4. Go to Releases and publish the release draft.

The NRK logo is a registered trademark of Norsk rikskringkasting AS. The license does not grant any right to use, in any way, any trademarks, service marks or logos of Norsk rikskringkasting AS.