@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()
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.Mounting later
Mount the screens right aftercreate() 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.
loading: the loading screen
loading: the loading screen
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.password: the password screen
password: the password screen
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.
playPrompt: click to start
playPrompt: click to start
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().afk: the idle warning
afk: the idle warning
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.
osk: text input for phones
osk: text input for phones
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.
files: files your app sends
files: files your app sends
While a file arrives, a notice shows its progress in percent.
See Send files to the viewer for the Unreal side.
links: links your app sends
links: links your app sends
Shown when your app sends a plain
https link.tcpToast: the UDP warning
tcpToast: the UDP warning
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.
controls: the control bar
controls: the control bar
Shown once the video plays, at the bottom right of the container. Three buttons:
disconnect: the end message
disconnect: the end message
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.
false switches that part off. See The screens.The colour of buttons, the spinner and badges. It is inserted into CSS: pass a colour you control, never user input.
mountUI() returns a MountedUI:
Switch a screen off
Set its option tofalse.
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
Your own CSS
Every element has a class that starts withspx-. 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.All classes
All classes
The layers, from back to front: full-size screens (
z-index 40), the control bar (50), the information popup (55), cards (60), notices (70).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:
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.