Skyline CLSP Player
An html5 CLSP video player. CLSP is a proprietary near-real-time video streaming protocol only available via Skyline's SFS solutions.
Table of Contents
Supported Browsers
Desktop
- Google Chrome 53+
- Mozilla Firefox 70+
- Microsoft Edge 80+ (Chromium-based)
All other desktop browsers are currently not supported.
Mobile
@todo
CLSP Streams
The highest h.264 keyframe/iframe segment frequency this player currently supports is 2 per second (this is different from frames per second).
URL Structure
The network protocol is handled by specifying the following URI format:
[clsp protocol] :// [sfs-host] : [port-number-of-web-socket] / [stream-name]
clsp protocol
: clsp
or clsps
sfs-host
: the host (or ip address) of the Skyline SFSport-number-of-web-socket
: optional, @see Default Portstream-name
: the stream name as defined on the Skyline SFS
Example stream url:
clsp://sfs.somecity.com/CityFeedVideo0652
Note that many Skyline SFS production LTS deployments use a default port of 9001
. To accomodate for this, you do not necessarilly need to append the port 9001
to every clsp
url. You can use the utility method utils.setDefaultStreamPort
, which is documented below.
Tokenization
Control stream access via hash tokens.
Hash
The MD5 hash authentication method provides authentication as well as stream access time.
[clsp-hash protocol]://[sfs-host]:[port-number-of-web-socket]/[stream-name]
?start=[time-epoch-seconds]
&end=[time-epoch-seconds]
&token=[hash-token]
clsp-hash protocol
: clsp-hash
or clsps-hash
sfs-host
: the host (or ip address) of the Skyline SFSport-number-of-web-socket
: required, @see Default Portstream-name
: the stream name as defined on the Skyline SFSstart
: contains the earliest time you want the stream to become available.end
: contains the latest time you want the stream to become available.token
: contains the entire url sans token, md5 + secret
The token is created by appending a shared secret to the url. That new string is used to create an MD5 hash. The shared secret must first be set up on the Skyline SFS and the stream-requesting application. You will need to work with Skyline to configure and use hash token support.
Default Port
protocol / SFS version | >= v5.2.0 | < v5.2.0 |
---|
clsp | 80 | 9001 |
clsps | 443 | 443 |
Note that many Skyline SFS production LTS deployments use a default port of 9001
. To accomodate for this, you do not necessarilly need to append the port 9001
to every clsp
url. You can use the utility method utils.setDefaultStreamPort
, which is documented below.
Installation
Via Yarn
yarn add @skylineos/clsp-player
Via NPM
Note that installation /use via yarn
is recommended as it is what we use for development, testing, and dependency management.
npm i @skylineos/clsp-player
Use
via <script>
tag
NOTE: See demos/simple-dist/
and demos/advanced-dist/
for full examples.
A CLSP
object is attached to window
, which contains the classes and utils you need to create players.
<head>
Tag
<head>
<link
rel="stylesheet"
href="/path/to/dist/clsp-player.css"
>
<head>
<script>
Tag
<script src="/path/to/dist/clsp-player.min.js"></script>
<script>
var videoElementId = 'my-video';
var urls = [
'clsps://bd-demo-sfs1.skyvdn.com/testpattern',
'clsps://bd-demo-sfs1.skyvdn.com/testpattern',
];
window.CLSP.utils.setDefaultStreamPort('clsp', 9001);
var iovCollection = window.CLSP.IovCollection.asSingleton();
var iov = iovCollection.create(videoElementId)
await iov.changeSrc(urls[0]);
var tour = window.CLSP.TourController.factory(
iovCollection,
videoElementId,
{
intervalDuration: 10,
},
);
tour.addUrls(urls);
tour.start();
</script>
<video>
tag
We recommend wrapping the video
tag in a container element (e.g. div
) that the CLSP Player can mutate as needed. The CLSP Player needs to perform some actions on the video
element as well as its container.
Note that for clsp
streams, the src
tag must have a type
attribute with a value of video/mp4; codecs='avc1.42E01E'
.
This tells the browser exactly what codec to use to decode and play the video. H.264 baseline 3.0 is a least common denominator codec supported on all browsers (according to the MSE development page).
<div class="video-container">
<div class="clsp-container-fit">
<video
id="my-video"
muted
playsinline
>
<source
src="clsps://bd-demo-sfs1.skyvdn.com/testpattern"
type="video/mp4; codecs='avc1.42E01E'"
/>
</video>
</div>
</div>
via import
or require
NOTE: See demos/simple-src/
and demos/advanced-src/
for full examples.
JS
import {
IovCollection,
TourController,
utils,
} from '@skylineos/clsp-player';
const videoElementId = 'my-video';
const urls = [
'clsps://bd-demo-sfs1.skyvdn.com/testpattern',
'clsps://bd-demo-sfs1.skyvdn.com/testpattern',
];
try {
utils.setDefaultStreamPort('clsp', 9001);
const iovCollection = IovCollection.asSingleton();
const iov = iovCollection.create(videoElementId);
await iov.changeSrc(urls[0]);
const tour = TourController.factory(
iovCollection,
videoElementId,
{
intervalDuration: 10,
},
);
tour.addUrls(urls);
tour.start();
}
catch (error) {
console.error(error);
}
Styles (SASS)
@import '/path/to/node_modules/@skylineos/clsp-player/dist/clsp-player.css';
@import '/path/to/node_modules/@skylineos/clsp-player/src/styles/clsp-player.scss';
<video>
tag
We recommend wrapping the video
tag in a container element (e.g. div
) that the CLSP Player can mutate as needed. The CLSP Player needs to perform some actions on the video
element as well as its container.
<div class="video-container">
<div class="clsp-container-fit">
<video id="my-video"></video>
</div>
</div>