Player reference
Everything the player takes and reports, for every way of embedding it.
Channels
A site can be assigned several channels. Each player plays one channel at a time: the one its embed names, or your site’s default channel when it names none. An embed names a channel by its slug, a short readable name such as spor-1, or by its channel ID, chan_ and 26 characters.
The channel has to be assigned to your site. One that isn’t shows “This player can’t play this channel”, and never falls back to your site’s default.
Slugs, channel IDs and older names
- A slug is made of lowercase letters, digits and hyphens. Spine’s embed links and snippets use it. It stays the same when Spine renames the channel. Spine can change a slug, though, and then embeds that name the old slug stop playing: they show “This player can’t play this channel”.
- A channel ID, such as
chan_01jdm8r7kx2p4s6v8y0a3c5e7g, never changes.
Both work in every way of embedding:
| Way | Name | Older name, still works |
|---|---|---|
| Iframe URL | channel |
channelId |
| Element attribute | channel |
channel-id |
| JS option and React prop | channel |
channelId |
| Vue prop (template) | channel |
channel-id |
The older names take a channel ID. If an embed sets both, channel wins.
The default channel
Spine sets it: the first channel assigned to a site becomes its default, and Spine can change it. A change of default reaches viewers within about a minute, without editing the embed.
If your site has no default channel, an embed that names none shows “This player can’t play this channel”.
Channel selector
Viewers can switch between your site’s channels from a menu in the player’s control bar, next to the quality menu. It shows only when all three hold:
- Spine allows it for your site. Ask Spine to turn it on.
- Your embed asks for it.
- Your site has more than one channel.
| Way | On | Off, the same as leaving it out |
|---|---|---|
| Iframe URL | channels=1 |
channels=0 |
| Element attribute | channel-selector |
channel-selector="false" |
| JS option and React prop | channelSelector: true |
channelSelector: false |
| Vue prop (template) | channel-selector |
:channel-selector="false" |
What viewers see when they switch
The menu’s button names the channel playing, and the menu lists your site’s channels by name. While the player shows a message instead of video, such as when the channel is off air or unavailable, the menu stays in the bottom-right corner over the message, so viewers can still switch.
When a viewer picks a channel, the player switches in place: the same player with the same settings, showing a spinner while it changes. Your page’s URL and the embed’s attributes, options and props don’t change. The pick lasts as long as that player. Reloading the page, or changing an attribute, option or prop, which starts the player over, starts again on the embed’s own channel.
The player doesn’t tell your page which channel a viewer picked. Its state is switching during the change, and then follows the new channel as usual.
Settings
Six settings change how the player plays and which language it speaks. None of them changes what it’s allowed to play. Each one you leave out uses your site’s default, which Spine sets for you, or else the player’s default. Language has no site default: left out, it follows the viewer’s browser.
| Setting | Iframe URL | Element attribute | JS option and React prop | Vue prop (template) | Player default |
|---|---|---|---|---|---|
| Latency | latency |
latency |
latency |
latency |
auto |
| Live pause | livepause |
live-pause |
livePause |
live-pause |
live |
| Data saver | datasaver |
data-saver |
dataSaver |
data-saver |
on |
| Maximum quality | maxquality |
max-quality |
maxQuality |
max-quality |
every quality |
| Debug panels | debug |
debug |
debug |
debug |
off |
| Language | language |
language |
language |
language |
the viewer’s |
Where a setting comes from
For each setting, the player uses the first of these that has a value:
- The embed: the iframe URL’s parameter, the element’s attribute, or the option you pass in code.
- Your site’s default, which Spine sets for you. Ask Spine to change a site default for all your players at once.
- The player’s default, in the table above.
A player reads your site’s defaults when it starts. A change Spine makes reaches a viewer the next time their player starts, not while it plays.
Language is the exception: a site has no default for it. When the embed doesn’t set one, the player speaks the viewer’s language.
The channel and the channel selector work differently. The channel is the embed’s, or your site’s default channel. The channel selector needs both Spine’s permission for your site and your embed’s request: neither shows it alone.
To override a site default:
- Turning something off:
debug="false"ordata-saver="false"on the element,debug: falseordataSaver: falsein code,debug=0ordatasaver=0on the iframe URL. - Removing a quality cap:
max-quality="all",maxQuality: nullormaxquality=all.
Latency
How far behind live the player plays standard-latency (HLS) streams. Low-latency (HESP) streams keep Dolby’s own latency, whatever this says.
| Value | Behavior |
|---|---|
low |
As close to live as the stream allows: about two segments behind. Most sensitive to a poor network. |
balanced |
One segment further back than low. |
smooth |
Two segments further back than low. Fewest stalls. |
auto |
Starts near low and moves back towards smooth when it stalls or runs short of buffer, then forward again after a quiet minute. |
The player keeps to its target by playing slightly faster or slower (1.05× or 0.95×), or jumping when it’s far out. The LIVE badge shows how far behind live the viewer is, and pressing it jumps back to live.
Live pause
| Value | Behavior |
|---|---|
off |
No pausing. The bar has no play button, and a pause is undone. |
live |
A pause stops downloading. Play jumps back to live. |
shift |
Downloading continues. Play carries on where it paused, as long as the broadcast still holds that point. The player doesn’t catch up again until the viewer presses LIVE. |
Data saver
On by default. While on:
- The automatic quality never goes above what the player’s size on screen needs, counting up to 2× for high-density screens.
- While the page is hidden or the player is scrolled out of view, the player drops to the lowest quality as long as someone listens.
- With nobody watching or listening, such as a muted player in a background tab, it stops downloading after 3 seconds and picks up again when someone looks. Picture-in-picture counts as watching.
Turn it off for screens where the player always fills the view, such as a TV-style app.
Maximum quality
The highest quality, by picture height, that the automatic choice and the quality menu offer: 720 hides everything above 720p. The quality menu never shows a quality above it.
It’s a preference, not a restriction. Spine’s own delivery limits for a channel apply on top of it, whatever the embed asks for.
Debug panels
Adds a button to the control bar, and two panels for troubleshooting:
- Stream Info (key
i): the player’s release, your embed and channel, what plays and why, and the stream’s renditions. - Network & Latency (key
l): latency and buffer over the last three minutes, bandwidth, segment downloads, and the player’s decisions in words.
The panels show IDs and numbers, never stream addresses or tokens, so they’re safe to screenshot for Spine. They load separately, so they cost nothing when off. With the iframe, debug=open also opens Stream Info when the player starts.
Language
The player speaks English (en) and Turkish (tr). The language covers everything a viewer reads or hears from a screen reader: the messages over the video, the LIVE badge, the quality menu, the channel menu, and the names of the buttons. Channel names are shown as Spine names them, whatever the language.
When the embed doesn’t set a language, the player uses the first language in the viewer’s browser settings that it speaks, and English if there’s none. A browser set to Turkish gets Turkish; one set to German and then English gets English. Set language when your page’s language should win, such as language=tr on a Turkish site. A code with a region, such as tr-TR, works too. A language the player doesn’t speak is ignored, as if you hadn’t set one.
Times, such as when an off-air channel comes back, use the viewer’s clock and the player’s language. The debug panels are for developers and Spine’s support, and stay in English.
What viewers see in each language:
| Where | English | Turkish |
|---|---|---|
| Off air | “Off air”, “Back at 14:00” | “Yayın dışı”, “Yeniden yayında: 14:00” |
| Nothing can play | “This stream isn’t available right now”, “It will start here by itself.” | “Bu yayın şu anda kullanılamıyor”, “Yayın başladığında burada kendiliğinden açılacak.” |
forbidden |
“This player can’t play this channel” | “Bu oynatıcı bu kanalı oynatamıyor” |
disabled |
“Playback is turned off for this site” | “Bu sitede oynatma kapalı” |
protected |
“Your access to this stream couldn’t be confirmed” | “Bu yayına erişiminiz doğrulanamadı” |
config |
“Can’t reach the stream”, “Check your connection.” | “Yayına ulaşılamıyor”, “Bağlantınızı kontrol edin.” |
media |
“The stream stopped playing” | “Yayın durdu” |
| After an error | “Try again” | “Tekrar dene” |
| Playing muted | “Tap to unmute” | “Sesi açmak için dokunun” |
| LIVE badge | “LIVE”, “4.2 s behind” | “CANLI”, “4,2 sn geride” |
| Quality menu | “Auto”, “Low latency”, “Standard latency” | “Otomatik”, “Düşük gecikme”, “Standart gecikme” |
| Channel menu | “Channel”; the button’s name for screen readers, “Channel: Spor 1” | “Kanal”; düğmenin ekran okuyucular için adı, “Kanal: Spor 1” |
Iframe URL whose path isn’t /embed/<embedId> |
“This player isn’t set up correctly.” | “Bu oynatıcı doğru kurulmamış.” |
| Iframe with an unknown embed ID | “This player isn’t available.” | “Bu oynatıcı kullanılamıyor.” |
The page for an unknown embed ID shows both languages at once, because it’s served before the player starts.
Options
create() (npm package), SpinePlayer.create() (hosted script), and the React and Vue components take these:
| Option | Type | Required | Description |
|---|---|---|---|
host |
string |
npm: yes. Hosted script: no. | The player host, https://player.spinectrl.com. The hosted script uses the host it came from. |
embedId |
string |
yes | Your site’s embed ID, with or without its emb_ prefix. |
channel |
string |
no | The channel to play, by its slug (spor-1) or ID (chan_…). It must be assigned to the site. Left out, the site’s default channel plays. See Channels. |
channelId |
string |
no | The older name for channel, by channel ID. It still works. |
channelSelector |
boolean |
no | Asks for the channel selector. See Channel selector. |
latency |
"auto" | "low" | "balanced" | "smooth" |
no | See Settings. |
livePause |
"off" | "live" | "shift" |
no | See Settings. |
dataSaver |
boolean |
no | See Settings. |
maxQuality |
number | null |
no | A picture height such as 720, or null for every quality. See Settings. |
debug |
boolean |
no | See Settings. |
language |
string |
no | "en", "tr", or a code with a region, such as "tr-TR". Otherwise the viewer’s browser language decides. See Settings. |
fill |
boolean |
no | Fill the container’s height too. Otherwise the player is 16:9 at the container’s width. |
onState |
(state: PlayerStateInfo) => void |
no | Called on every change of state. In Vue, listen to the state event instead. |
getGrant |
(request: GrantRequest) => Promise<string | null> |
no | On a site with customer grants: gets each viewer’s grant from your backend. On the element, it’s a property. See Protected playback. |
license |
string |
no | The video engine’s licence. Leave it out: the player gets it from the host. |
libraryLocation |
string |
no | Where the video engine’s worker files are, ending in /. Leave it out unless you serve them yourself (see npm packages). |
The player handle that create() returns
create() and SpinePlayer.create() return:
interface SpinePlayer extends PlayerCommands {
/** Stops media, timers and listeners, and removes the player. Safe to call twice. */
destroy(): void;
/** The current state. */
state(): PlayerStateInfo;
/** Settles once the player's code has loaded, or failed to. Never rejects. */
readonly ready: Promise<void>;
}You can call destroy(), state() and the commands straight away, before the player’s code has loaded. Commands then do nothing, as while nothing plays, but for setChannel(), which picks the channel the player starts on.
The player also stops by itself when the page unloads. In a single-page app, call destroy() when the player’s view goes away; the element and the React and Vue components do it for you.
Commands
Your page can control the player as a viewer’s controls would. The iframe takes no commands.
| Command | What it does |
|---|---|
play() |
Plays, as the play button does. With live pause live it jumps back to live, and with shift it carries on from where it paused. |
pause() |
Pauses, as the pause button does. With live pause off, the player plays on. |
mute() |
Turns the sound off. |
unmute() |
Turns the sound on. Call it from a viewer’s click or tap: without one, a browser may refuse, or pause the player. |
setChannel(channel) |
Switches to another of your site’s channels, by its slug or ID, in place, as the channel selector does, whether or not the selector shows. Asking for the channel playing does nothing. A channel your site isn’t assigned shows “This player can’t play this channel”. |
requestPictureInPicture() |
Asks the browser to show the video in its picture-in-picture window, and returns true. Returns false where it can’t: in a browser without one, such as Firefox, or while nothing plays. Call it from a viewer’s click or tap. |
exitPictureInPicture() |
Brings the video back from the picture-in-picture window. |
- Play, pause, the sound and picture-in-picture act on what plays now. They do nothing until the player has a stream, and while it has none, such as off air. The player starts by itself, muted, so pause it once its state says
playing.loadingdoesn’t do: on a protected site the player may still be waiting for its playback session then, with no stream yet. - Your page sees what happened in the state:
pausedorplaying,muted, andpictureInPicture, which also changes when a viewer closes the window themselves. - The picture-in-picture window shows only the video. The player’s controls and messages stay in your page.
- A channel switched with
setChannellasts as long as that player, as a viewer’s pick does. The element’schannelattribute and the components’channelprop don’t change, and changing an attribute, option or prop starts the player over on its own channel.
Where each way takes them
| Way | How |
|---|---|
<spine-player> element |
methods on the element: document.querySelector("spine-player").play() |
create() / SpinePlayer.create() |
methods on the player it returns |
| React component | a ref: ref.current?.play() |
| Vue component | a template ref: player.value?.play() |
| Iframe | none |
interface PlayerCommands {
play(): void;
pause(): void;
mute(): void;
unmute(): void;
/** By the channel's slug or ID. */
setChannel(channel: string): void;
/** False where the browser can't, or while nothing plays. */
requestPictureInPicture(): boolean;
exitPictureInPicture(): void;
}States
interface PlayerStateInfo {
status: PlayerStatus;
problem: Problem | null;
muted: boolean;
/** The video shows in the browser's picture-in-picture window. */
pictureInPicture: boolean;
}
You get it from onState, the element’s spine-state event, the Vue component’s state event, or state(). The iframe doesn’t report it.
status |
What it means | What the viewer sees |
|---|---|---|
idle |
Starting: the player is reading its configuration. | a spinner |
loading |
A stream is attached and hasn’t shown its first frame yet. | a spinner |
playing |
Playing. | the video, and “Tap to unmute” while muted |
paused |
Paused by the viewer, or by a browser that wouldn’t autoplay. | a play button |
switching |
Moving to another stream, as when the schedule changes from low latency to standard, or to a channel the viewer picked. | a brief interruption, or a spinner while it changes channel |
reconnecting |
The stream failed and the player is trying it again. | a spinner |
offAir |
Off air: by the schedule, or because the broadcast has stopped. Nothing is downloaded. | “Off air”, with the time playback returns when it’s known |
unavailable |
Nothing can play right now. The player keeps checking and starts by itself. | “This stream isn’t available right now” |
denied |
This player may not play this channel. See problem. |
a message, depending on problem |
error |
Recovery ran out. See problem. |
a message and a “Try again” button |
disposed |
Destroyed. | nothing |
problem |
With status | What it means | What the viewer sees | What you can do |
|---|---|---|---|---|
forbidden |
denied |
The embed ID or channel is unknown, such as a slug Spine has changed, the channel isn’t assigned to your site, or the embed names no channel and your site has no default. Spine never says which. A grant for another site or channel ends here too. | “This player can’t play this channel” | Check the embed ID and the channel’s slug or ID. Ask Spine whether the channel is assigned to this site, or which channel is its default. |
disabled |
denied |
Spine has turned playback off for your site or your account. | “Playback is turned off for this site” | Contact Spine. |
protected |
denied |
Your site uses customer grants, and the player got no grant from your page, or Spine kept refusing the grants it got. The player asks again about a minute later. | “Your access to this stream couldn’t be confirmed” | Check your page’s getGrant or serveGrants, and your grant endpoint. See Protected playback. |
config |
error |
The player couldn’t reach Spine’s host, three times in a row. | “Can’t reach the stream”, “Check your connection.” | Usually the viewer’s network. Also check your page’s CSP and ad blockers. |
media |
error |
The stream kept failing after retries. | “The stream stopped playing” | The viewer can press “Try again”. If it persists, contact Spine. |
problem is null in every other state. The messages are shown here in English; the Language setting, under Settings, lists them in Turkish too.
The player keeps working on its own in every state but denied, error and disposed: it moves between playing, switching, off air and unavailable as Spine’s schedule and the stream change, without anything from your page.
How to get the state, and an example
| Way | Event |
|---|---|
<spine-player> element |
spine-state, a CustomEvent whose detail is the state. It bubbles and crosses shadow roots. |
create() / SpinePlayer.create() |
the onState option |
| React component | the onState prop |
| Vue component | the state event |
| Iframe | none yet |
The player reports only its state. It never hands your page stream addresses or tokens.
function onState({ status, problem, muted }) {
if (status === "playing") showLiveBadge();
else hideLiveBadge();
if (status === "denied" || status === "error") {
reportToYourMonitoring("spine-player", { status, problem });
}
}Protected playback
Only for a site on customer grants: the player needs a grant from your page to start, and a fresh one about every four minutes to renew (see Security and access).
How each way hands over grants
| Way | How |
|---|---|
| Iframe | SpinePlayer.serveGrants(iframe, getGrant) from the hosted script, serveGrants from @spinemedia/player, or your own answer to its messages. See Iframe embed. |
<spine-player> element |
its getGrant property, which you can set at any time |
create() / SpinePlayer.create() |
the getGrant option |
| React component | the getGrant prop |
| Vue component | the get-grant prop |
| An app’s WebView opening the embed | none: such a site uses protection off or player grants |
interface GrantRequest {
/** Your site's embed ID in full, with its `emb_` prefix. */
embedId: string;
/** The slug of the channel the player plays, even when the embed names it by ID or names none. */
channel: string;
/** Starting a session, or renewing the one that plays. */
reason: "start" | "renew";
}
type GrantProvider = (request: GrantRequest) => Promise<string | null>;- The player asks when it starts, about every four minutes while it plays, when a viewer switches channel, and when it restarts the stream after a failure.
- No grant, whether
null, a promise that rejects or no answer, means no playback: the player reportsdeniedwith the problemprotected, and asks again about a minute later. - A grant Spine refuses as invalid, expired or already used is tried once more, with a fresh grant from your page. If Spine refuses that one too, the player stops with the problem
protected. - At protection off and on player grants, the player never asks, so you can add
getGrantbefore Spine moves your site to customer grants.
Size and shape
- Iframe: the player fills the frame. You size the
<iframe>. - Element,
create(), components: the player is as wide as its container and 16:9 tall. Withfill, it takes its container’s height as well. - Another shape: set the CSS custom property
--spine-player-aspect-ratio, such as4 / 3, on the container or any ancestor.
Your CSS doesn’t reach inside the player, and the player’s CSS doesn’t reach your page.
Good to know
Behavior you can rely on
- It starts muted and plays on its own. Browsers don’t allow autoplay with sound. If a browser blocks muted autoplay too, as in some battery-saving modes, the player waits with a play button.
- It follows Spine’s schedule by itself. It checks for changes about once a minute, so a scheduled change reaches every viewer within about a minute, at slightly different moments for different viewers. A change Spine makes on the spot, such as switching a channel to low latency now, reaches every viewer within about a minute and a half. Don’t reload the player for a schedule change.
- It recovers by itself. A failing stream is retried, up to three times, before the viewer gets “Try again”. A temporary loss of connection keeps the current stream playing; the player checks again as soon as the device is back online or the page is visible again.
- It never falls back to something it shouldn’t play. A refusal stops playback. It never plays another site’s stream, an unprotected one for a protected site, or your site’s default channel in place of one it can’t play.
- On a protected site, it renews by itself. About every four minutes it renews its session without interrupting playback, with a fresh grant from your page on a site with customer grants.
- A viewer’s pause survives schedule changes and background checks.
- Switching between low latency and standard can interrupt playback briefly and changes how far behind live the viewer is. It isn’t seamless.
- Viewers may choose. Where Spine allows it, the quality menu lists both “Low latency” and “Standard latency” with their qualities, and “Auto” follows Spine’s schedule. A viewer’s pick lasts until what Spine plays changes; then the player follows the schedule again.
- Viewers may switch channels where Spine allows it and your embed asks for the channel selector. Your page may switch it with
setChannelon any site.
Keyboard
The controls are buttons you can reach and press with the keyboard. With debug on, i and l open the debug panels while the player has focus, or anywhere on the page in the iframe.
Not supported yet
- AirPlay and Chromecast: the player turns them off, so viewers never see a cast button that fails.
- DVR: seeking back through the broadcast.
- Subtitles.
- Languages other than English and Turkish.
- Custom branding (colors, logo). Spine plans it as site configuration.
- Events and commands between the iframe and your page.
- Telling your page which channel a viewer picked in the channel selector.
Privacy
The player sends no cookies to Spine’s host, and Spine’s player code collects no viewer analytics today. The video engine is THEOplayer, by Dolby. Dolby’s delivery, like any video CDN, sees each viewer’s IP address and referrer.