Skip to main content
Intermediate For web developers who want a complete viewer experience without drawing every screen. After this page you can mount the screens, switch any of them off, restyle them, and replace one with your own. The SDK draws the video and nothing else. @streampixel/ui draws everything a viewer sees around it. It is plain DOM inside your container, with no framework.
@streampixel/ui is an npm package. It is not in the script-tag build. Unlike the stream engine, these screens are part of the package you install: a fix to them needs a new install.

Mount the screens

1

Install

2

Mount right after create()

Pass the same element as the stream’s container: the screens go on top of the video.
You see the loading screen with your project’s logo and loading texts, then your app with a control bar at the bottom right.
3

Remove them in the right order

mountUI() returns an object with one method, destroy(). Call ui.destroy() before stream.destroy(), when you tear down and when you start again.
The logo, the banner and the loading texts come from the project’s settings in the dashboard: see Branding.

Mounting later

Mount the screens right after create() resolves. They can also be mounted later: mountUI() shows the screen for the state the stream is in at that moment.

The screens

Ten parts, all on by default. Each has an option of the same name that switches it off. Open a part for its exact behaviour and wording.
Shown until the video plays, and again while the stream reconnects or restarts.In a Test locally session the status line says “Waiting for your Unreal Editor…” while it connects, and “Waiting for your Unreal Editor to come back…” while it reconnects.With disconnect: false, this screen also shows the end message.
Shown while the stream is in the state awaitingPassword: the project’s logo, “This stream is protected”, a password field and Continue.The field is cleared after every attempt. The package never keeps the typed password. See Access for how password projects work.
Shown while the state is awaitingPlay: the stream is up, and the browser refused to start the video without a click. The card says “Ready to start” and “Your browser paused the stream.”, with a “Click to start” button that calls stream.play().
Shown while the idle countdown runs: “Are you still there?”, “No activity detected”, the seconds left, and an “I’m still here” button. The button cancels the countdown. When the countdown reaches zero, the session ends and the end message says so.
Shown when your app asks for text input (a text field in your app got focus). The card says “Enter text” and has a text field with what your app’s field already holds, Send and Cancel. Enter sends, Escape closes. The card also closes when your app asks to hide the keyboard.
While a file arrives, a notice shows its progress in percent.See Send files to the viewer for the Unreal side.
Shown once, when UDP is blocked on the viewer’s network and the stream is relayed over TCP, which reduces quality. The notice stays for 15 seconds, or until the viewer clicks it. It appears only when the project’s “UDP blocked warning” setting is on.
Shown once the video plays, at the bottom right of the container. Three buttons:
Shown when the state is ended: a title, the sentence from ended.message, and one button.When the stream ends, the idle warning, the text-input card and the file and link cards close, so nothing stays on top of the end message.

Options

mountUI(stream, options) takes these options.
HTMLElement
required
Where the screens go: the stream’s container.
false switches that part off. See The screens.
string
default:"#4e9cff"
The colour of buttons, the spinner and badges. It is inserted into CSS: pass a colour you control, never user input.
() => void
What the button on the end message does. Without it, the button reloads the page.
mountUI() returns a MountedUI:
() => void
Removes every screen this call added. Call it before stream.destroy().

Switch a screen off

Set its option to false.
A part you switch off is not replaced by anything. Without playPrompt, a viewer whose browser blocks autoplay sees a paused video and no hint to click it. Without afk, an idle viewer is disconnected with no warning. Switch a part off when you do not need it, or when you draw your own.
With files or links switched off, the SDK’s own default applies again: desktop browsers download the file or open the link, and phones and tablets do nothing.

Restyle the screens

The accent colour

If you mount several UIs on one page, they share one set of styles, and the accent colour comes from the UI that was mounted first.

Your own CSS

Every element has a class that starts with spx-. Override the classes in your own stylesheet.
styles.css
The package adds its styles to the end of <head> when you mount, so they come after your stylesheet. A rule of yours with the same selector would lose. Start your selectors with your container (#stream .spx-btn), which makes them more specific.
The layers, from back to front: full-size screens (z-index 40), the control bar (50), the information popup (55), cards (60), notices (70).
The wording is English and fixed. To change a text, replace that part.

Replace one screen with your own

Switch the part off, and draw your own from the SDK’s states and events. The other parts keep working. This example replaces “Click to start” with a button of your own. The button sits next to the container, in a wrapper, and above the video:
What each part is built from: Two parts need care when you replace them: Complete recipes for your own loading screen, queue display, idle warning and more are in the Cookbook. The states and events are in Events and states.

What it does to your page

What it does not have

Next steps

Cookbook

Your own loading screen, queue display, idle warning and more.

Events and states

One level up: everything the screens are built from.

Controls and input

Sound, resolution, fullscreen and input, for your own control bar.

Access

Password, single sign-on and your own password form.