panels/stats-data
What every stats view reads: the core's stream state, the rows and tiles
worded from it, the graphs' series and scales, and the copied report. The
views themselves are stats-view.tsx; what a row says and when it warns is
lib/stream-stats-view.js.
The state is the core's window.stream_info, window.stream_client, and
window.stream_stats (selkies-web-core/lib/stream-stats.js), read each
time the core announces a change (STATS_EVENT) while a view is on screen
in a visible tab. Being on screen is what turns the numbers on: each view
holds them through holdStats, so the core is told the stats shut only when
the last view goes.
Interfaces
Snapshot
Defined in: panels/stats-data.ts:44
What one read of the core's state holds.
Properties
info
info: StreamInfo;Defined in: panels/stats-data.ts:46
The server's description of the stream, null until it arrives.
client
client: StreamClient;Defined in: panels/stats-data.ts:48
This page's description of the stream.
latest
latest: object;Defined in: panels/stats-data.ts:50
The last second's figures.
history
history: object[];Defined in: panels/stats-data.ts:52
Every second since the stats opened, appended to in place.
length
length: number;Defined in: panels/stats-data.ts:54
The history's length at the read, which is what changes between reads.
GraphData
Defined in: panels/stats-data.ts:120
One graph's series against one axis, and the value at its top edge.
Properties
series
series: object[];Defined in: panels/stats-data.ts:121
name
name: string;values
values: number[];max
max: number;Defined in: panels/stats-data.ts:122
Type Aliases
Status
type Status = "good" | "warn" | "neutral";Defined in: panels/stats-data.ts:177
A row's state; its mark carries it as a shape as well as a color.
StatusMarkComponent
type StatusMarkComponent = React.ComponentType<{
status: Status;
}>;Defined in: panels/stats-data.ts:180
A layout's mark beside a row or a warned figure.
Functions
useStreamSnapshot()
function useStreamSnapshot(on): Snapshot;Defined in: panels/stats-data.ts:63
Reads the core's stream state on every announcement while on in a
visible tab, holding the numbers on meanwhile.
Parameters
| Parameter | Type | Description |
|---|---|---|
on | boolean | Whether the view is on screen. |
Returns
The latest read, or null before the first.
rowWords()
function rowWords(): object;Defined in: panels/stats-data.ts:95
The words the rows are worded with.
Returns
object
hardware
hardware: any;software
software: any;unknown
unknown: any;throttled
throttled: any;hardware_available
hardware_available: any;software_preferred
software_preferred: any;snapshotRows()
function snapshotRows(snapshot): StreamRow[];Defined in: panels/stats-data.ts:107
The rows of what the stream runs on (streamRows), worded.
Parameters
| Parameter | Type |
|---|---|
snapshot | Snapshot |
Returns
StreamRow[]
snapshotTiles()
function snapshotTiles(snapshot): object[];Defined in: panels/stats-data.ts:112
The figures as tiles (streamTiles).
Parameters
| Parameter | Type |
|---|---|
snapshot | Snapshot |
Returns
object[]
axisTop()
function axisTop(floor, ...lists): number;Defined in: panels/stats-data.ts:117
The top of a graph's axis: the largest value drawn with a little headroom, never under floor.
Parameters
| Parameter | Type |
|---|---|
floor | number |
...lists | number[][] |
Returns
number
useStatsGraphs()
function useStatsGraphs(snapshot, framerate): Record<"fps" | "mbps" | "rtt", GraphData>;Defined in: panels/stats-data.ts:132
The three graphs' series: frame rate (the client's, and the server's where it reports one) on an axis from the configured frame rate up, bitrate, and round trip.
Parameters
| Parameter | Type | Description |
|---|---|---|
snapshot | Snapshot | The latest read. |
framerate | number | The configured frame rate, the floor of the fps axis. |
Returns
Record<"fps" | "mbps" | "rtt", GraphData>
useCopyReport()
function useCopyReport(snapshot): object;Defined in: panels/stats-data.ts:162
Copies the stats as text (streamReport) and says so for a moment.
Parameters
| Parameter | Type | Description |
|---|---|---|
snapshot | Snapshot | The latest read. |
Returns
object
Whether a copy just landed, and the copy action.
copied
copied: boolean;copy
copy: () => Promise<void>;Returns
Promise<void>