Skip to main content

Getting started JS

Prerequisites#

  • Knowledge of HTML
  • Basic understanding of JavaScript

Adding a video#

Load the JavaScript SDK#

Before you can use our SDK you have to add the JavaScript library to your page, preferably in the <head>.

<script src="//cdn.jet-stream.com/static/pp/2.1.0/privacy-player.min.js"></script>

Setup the HTML#

Once that is loaded on your page you can embed any desired video or livestream in your page.

The way it works is that you have to tell the player where it should place the video. In this example it needs to be placed in the <div> element with id "video-wrapper".

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="//cdn.jet-stream.com/pp/2.1.0/privacy-player.min.js"></script>
</head>
<body>
<h1>Video webpage</h1>
<div id="video-wrapper" style="height: 480px"></div>
</body>
</html>

Loading the video#

So we need to have the link to the video (you can get that from VDO-X or the API) and we are ready to emebed the video.

We start with finding the "video-wrapper" element, and then tell the PrivacyPlayer that it should mount the video in there.

let video_wrapper = document.querySelector("#video-wrapper")
let player = new PrivacyPlayer(
"//rrr.sz.xlcdn.com/?account=demo&file=sintel-surround.smil&type=streaming&service=wowza&poster=sintel-surround.jpg&output=player",
video_wrapper, true, true
)

The result should look like this (screenshot, not actual player): player screenshot