Custom elements
Clocks, stopwatches, lists, video, NDI, masks, flags and slideshows for HTML layouts.
layout.js brings custom elements for what Screens.Controls does in XAML layouts. Use them like any HTML element: CSS places, sizes and animates them. Give them an id to control them from a client.
Their properties and methods have the ScreensPro names, so the packets are the same as for the XAML elements: SetProperty Text / TargetTime / Items, CallMethod Start / Stop / Play. Attributes are written in lower case with dashes (items-visible), properties in ScreensPro's spelling (ItemsVisible). Every attribute can also be bound with data-set-<name>.
Time formats
The time elements show their digits in tabular figures, so the text doesn't jump.
ScreensPro's format letters (default, the same as the XAML time elements): capitals always with leading zeros, small letters only when needed.
HH, MM, SS
Always, with a leading zero
hh, mm, ss
Only when there is something to show, with a leading zero after a larger part. A separator after a part left out is left out too
hH, mM, sS
Always, with a leading zero only after a larger part
GG, gg, gG
The hours of the 12-hour clock
A, a
AM / PM
f, k
The fraction: ff / kk = hundredths
\x
x as text
+, -
The sign: + always, - when negative
hh:mM:ss shows 0:45, 12:34 and 1:02:05, MM:SS.ff shows 02:05.40. Digits are cut, not rounded.
Standard formats with format-style="clock" (<sp-clock>, also dates) or format-style="duration" (stopwatch, target time):
HH / hh
Hours 24 h / 12 h
Hours
mm
Minutes
Minutes (without hours they count on past 59)
ss
Seconds
Seconds
f, ff, fff
Tenths, hundredths, milliseconds
the same
tt
AM / PM
yyyy, yy, MM, dd
Date
[h:]
Shown only from one hour on: [h:]mm:ss
'text'
Literal text
Literal text
Fixed boxes instead of tabular figures: digit-width="0.6em" puts each digit, separator-width="0.3em" each other character (: . , -) in a box of that width. auto = the widest character in the element's font (XAML DigitWidth="Auto").
sp-clock
The time of day.
format
Format
HH:mm:ss
Time format
format-style
clock: the standard formats, also dates
offset
Offset
0
Offset in seconds (or a TimeSpan hh:mm:ss), e.g. another time zone
blink
The colons blink every other second
digit-width, separator-width
Fixed boxes, see above
Text
A fixed text instead of the time; empty = the time again
sp-stopwatch
As the StopwatchElement: shows nothing until it is started.
format
RunningFormat
Format while running. Default: ScreensPro's (8.4, 1:23.4, 1:02:03.4, tenths)
format-stopped
StoppedFormat
Format when stopped (default: format, else hundredths)
format-style
duration: the standard formats
autostart
Starts when the layout goes on air
digit-width, separator-width
Fixed boxes
IsRunning
Read only
Start()
Starts from zero
StartWithTime(time)
Starts from that time (00:01:30 or seconds)
StartBackwards(time)
Counts down in whole seconds to zero, then sends ElementFinished
StartedAt(time)
Runs as if it had been started at that time: a time of day (20:15:00), a date and time, or a time from now (+00:00:20). With a time still to come the stopwatch starts then and shows - until it does
Stop([text or time])
Stops: shows the time it stopped at, or the time or text given
Pause(text, seconds)
Shows the text for that many seconds (0 = until Resume), then what it showed before. The stopwatch keeps running
Resume()
Ends a pause
Set(time)
Stops and shows that time
Reset()
Stops and shows nothing
Times are a TimeSpan as ScreensPro sends it ([-][d.]hh:mm[:ss[.fffffff]]) or a number of seconds.
sp-targettime
The time to a target (counting down) and since it (counting up). Reaching the target sends ElementFinished.
target
TargetTime
The target, see below
TargetDate
Read only: the target as a point in time (a Date), for the layout's own scripts
mode
Mode
UpAndDown
UpOnly: zero before the target, DownOnly: zero after it
format
RunningFormat
whole seconds
Duration format
format-style
duration: the standard formats
digit-width, separator-width
Fixed boxes
The target is one of:
2026-11-01T20:15:00
A date and time
20:15:00
A time of day, today
+00:05:00
A time from now: 5 minutes after the element got the value (also +300, in seconds)
A time from now makes a countdown that works whenever its layout is shown, without the client working out the time: a break of 5 minutes, a start in 30 seconds. It counts from the moment the value arrives. The same value again keeps that moment, so a client may send its data as often as it likes; another value, or loading the layout again, starts anew. ScreensPro Server doesn't know this form: use it in layouts for ScreensPro Native only.
sp-items
A list, as the ItemsElement / ListElement: the items in pages, the next page after an interval, row by row animated.
items
Path of the list in the data context. items="" (or .) = the data context itself (ItemsSource="{Binding}")
Items / ItemsSource
Set by a client: a list, JSON text or a .NET list ($values). Wins over the binding
items-visible
ItemsVisible
all
Rows per page
change-interval
ChangeInterval
10
Seconds (or 00:00:16) until the next page
per-item-delay
PerItemDelay
0
Delay per row for the row animations, in seconds
The
<template>holds one row; bindings in it are relative to the item.Each row gets the classes
sp-row,sp-odd/sp-even,sp-row-inwhile it comes in andsp-row-outwhile it leaves, and the CSS variable--sp-delay(its position ×per-item-delay). The list waits for the out animations before the next page comes in.After the last page the list sends ElementFinished and starts again from the first. A single page stays.
In the preview the rows are just there (class
sp-row-static).
New items while the list is on air
A list that is on air and gets other items - a client sends new data, a data source has a new answer - starts again from its first page: all rows leave, the first page comes. Four attributes change that, the same options as ScreensPro's ItemsElement and ListElement have:
data-content-changed-delay-mode
DataContentChangedDelayMode
Now
When items that differ from the shown ones show: Now, AfterCurrentPage (with the next page change) or AfterLastPage (when the list is through)
data-content-changed-mode
DataContentChangedMode
StartFromBeginning
Where the list goes on: StartFromBeginning (the first page) or KeepPosition (the page it is on)
data-changed-delay-mode
DataChangedDelayMode
AfterCurrentPage
The same for the same items set again
data-changed-mode
DataChangedMode
KeepPosition
The same for the same items set again. By default nothing happens; StartFromBeginning starts the list again whenever its data is sent again
KeepPositionwithNow: of the rows the list shows only those that differ leave and come, the others stay as they are, and the time to the next page goes on. Changes on other pages show when it is their turn. With fewer items than before the list shows the last page there is.KeepPositionwithAfterCurrentPage: the next page change shows the page after the current one, with the new items.AfterLastPage: the list always starts with the new items from its first page.A list with a single page that has had its time, and a list in the preview, take new items at once.
"The same items set again" means new data with the same rows: a client sent its data again, a data source answered again. Other values of the data changing don't count.
Use KeepPosition for lists that change often. With the default, a list whose data changes more often than it needs for its pages never reaches its last page.
In XAML layouts the ListElement and the ItemsElement take the same four properties (DataContentChangedMode="KeepPosition").
sp-video
A video clip. ScreensPro Native plays the clip itself and puts it into the output exactly where the element is - its position, size, CSS transform (also 3D), opacity and rounded corners, every frame. So it moves, scales and fades like any element, at full quality.
src
Source
The clip, relative to the layout folder
path + filename
Path, Filename
As the XAML VideoElement: folder and file name
loop
Loop, LoopVideo
off
Plays in a loop
fit
contain
contain, fill or none
autoplay
on
autoplay="false": plays only on Play()
delay
0
Seconds after the layout goes on air; its first frame until then
layer
below
above: drawn over the rest of the layout instead of under it
resolution
element
full: decoded at the size of the video format, for elements an animation scales up
Play(), Pause(), Stop(), Restart()
Seek(seconds)
Jumps to that position
Any format FFmpeg reads: ProRes 4444 with its alpha, H.264, HEVC, VP9, DNxHD, PNG; hardware decoding where there is one.
The video plays when its layout goes on air. The end of a clip that doesn't loop sends ElementFinished - only for an element with an
id(a clip without one is decoration).The picture is drawn under the rest of the layout, so the layout must be transparent where the video shows. Text, frames and shadows on top of it work.
CSS
filter,mix-blend-mode,clip-pathand CSS masks don't apply to the picture; an<sp-mask>around it does.The preview pictures the clients get don't show the video; program and outputs do.
sp-ndi
An NDI source in the layout, drawn like <sp-video> (same placement, fit, layer, resolution).
source
Source
The NDI source name, MACHINE (Source) - or only the source part together with machine
machine
Machine
The computer, as the XAML NdiElement
fit, layer, resolution
As for <sp-video>
Set Source from a client to switch to another NDI source.
sp-mask
Shows what is in it through an animated mask clip, like a track matte or G-Studio's Mask effect. It masks everything in it alike, the <sp-video> / <sp-ndi> pictures too. The element's box is the mask's: nothing in it shows outside the box.
The clip is a sprite sheet: its frames left to right and top to bottom, the alpha is the mask. Make one from any video with alpha:
src
The sprite sheet
frames
1
Number of frames in it
columns
frames
Frames in a row
fps
50
Frames per second of the clip
delay
0
Frames after the in (or out) animation starts
play
in
in: plays with the in animation and keeps the last frame. out: with the out animation. in out: both - the out animation plays it again inverted, taking away what it revealed. none: only by Restart()
invert
off
Shows where the mask is transparent
Restart()
Plays the clip
Stop()
Shows the first frame
Finish()
Shows the last frame
A sheet with one frame is a still mask, e.g. a shaped hole for a video picture.
sp-wave
A waving flag, the same effect as ScreensPro's FlagWaveEffect. The image fills the element; size it with CSS. For a pole on the right, mirror it with transform: scaleX(-1).
src (or data-src)
The image
speed
Speed
0.8
Wave cycles per second; 0 = stopped (then phase 0…1 sets where it stands)
amplitude
Amplitude
0.04
Up and down at the free end, as a fraction of the height
wavelength
Wavelength
0.6
One wave, as a fraction of the width
shading
Shading
0.4
Light and shadow, 0…1
anchor
Anchor
1
1 = the pole side doesn't move, 0 = all of it moves (a banner)
slant
Slant
0.15
Diagonal waves: shift from top to bottom, in waves
fabric
Fabric
0
Woven fabric, 0 = off, 0.3 = clearly visible
fabric-size
FabricSize
3
Thread width in pixels
phase-offset
PhaseOffset
0
Fraction of a cycle, so several flags don't move in lockstep
phase
Phase
0
Where a stopped wave stands
sp-slideshow
The images of a folder in the layout folder, one after the other.
folder
The folder, relative to the layout folder (PNG, JPEG, WebP, GIF, SVG)
change-interval
ChangeInterval
10
Seconds per image
transition
fade
fade, down or none
The images are fitted into the element (object-fit: contain).