V-NOVA
Search…
Embedding LCEVC-enabled demo hls.js player
This page provides instructions on how how to incorporate V-Nova’s LCEVC-enabled demo hls.js player into any webpage.
The first step to include the V-Nova LCEVC HTML5 player in your website is to add the JavaScript, WebAssembly, and hls.js sources.

Example

First, we need to add the player source files into the element of our template. The example provided points to publicly hosted binaries for hls.js along with the additional LCEVC decoder integration layer (DIL) components that are hosted and maintained by V-Nova.
1
<html>
2
<head>
3
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
4
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.0.2/hls.js"></script>
5
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/liblcevc_dpi.js"></script>
6
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil.min.js"></script>
7
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil_patch_hls.js"></script>
8
</head>
9
10
<body>
11
</body>
12
</html>
Copied!
Then, we have to add a HTMLDivElement and the style, where we want our player to be inserted. An id is required which will be used later to identify the HTMLElement. The style of the player requires that the position is relative in order to ensure the correct aspect ratio of the video.
1
<html>
2
<head>
3
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
4
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.0.2/hls.js"></script>
5
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/liblcevc_dpi.js"></script>
6
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil.min.js"></script>
7
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil_patch_hls.js"></script>
8
<style>
9
#player {
10
width: 100%;
11
position: relative;
12
}
13
</style>
14
</head>
15
16
<body>
17
<div id="player"></div>
18
</body>
19
</html>
Copied!

Configure your player

The LCEVC-enhanced hls.js player offers options to customise some features like dynamic performance scaling (DPS), logging, etc. however we will start with an empty configuration:
1
<html>
2
<head>
3
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
4
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.0.2/hls.js"></script>
5
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/liblcevc_dpi.js"></script>
6
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil.min.js"></script>
7
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil_patch_hls.js"></script>
8
<style>
9
#player {
10
width: 100%;
11
position: relative;
12
}
13
</style>
14
</head>
15
16
<body>
17
<div id="player"></div>
18
<script>
19
const url =
20
'https://d3mfda3gpj3dw1.cloudfront.net/vnVCommJVddTqCWj/master.m3u8';
21
const playerElement = document.getElementById('player');
22
const lcevcConfig = {};
23
</script>
24
</body>
25
</html>
Copied!
To show the video player controls, specify an existing HTMLElementID (or specify one that will be created with the command we will see later) and set the enable option to true. Also, in order to enable the player layout that includes a toggle button to demonstrate the difference between LCEVC-enhancement being enabled or disabled during playback we will set the toggleButton option to true. For a standard player layout without this demonstration feature set the toggleButton option to false.
1
const lcevcDilConfig = {
2
playerControls: {
3
controlsID: 'player-controls',
4
enabled: true,
5
toggleButton: true
6
},
7
};
Copied!
The next step is to initialise a new instance of the LCEVC-enhanced hls.js player, which requires the URL of the stream to be loaded, the HTMLElement from before and it’s configuration:
1
const simplePlayer = dilHlsSimplePlayer(url, playerElement, lcevcConfig);
Copied!
The dilHlsSimplePlayer wrap the necessary commands to create the canvas, initialise hls.js and DIL.js, and auto play the video once is loaded.
All those code snippets put together creates the V-Nova LCEVC-enhanced hls.js player in your website:
1
<html>
2
<head>
3
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
4
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.0.2/hls.min.js"></script>
5
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/liblcevc_dpi.js"></script>
6
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil.min.js"></script>
7
<script type="text/javascript" src="https://d3mfda3gpj3dw1.cloudfront.net/LCEVC_HTML/dil.js/lcevc_dil_patch_hls.js"></script>
8
<style>
9
#player {
10
width: 100%;
11
position: relative;
12
}
13
</style>
14
</head>
15
16
<body>
17
<div id="player"></div>
18
<script>
19
const url = 'https://d3mfda3gpj3dw1.cloudfront.net/vnVCommJVddTqCWj/master.m3u8';
20
const playerElement = document.getElementById('player');
21
const lcevcDilConfig = {
22
playerControls: {
23
controlsID: 'player-controls',
24
enabled: true,
25
toggleButton: true
26
}
27
};
28
29
const simplePlayer = lcevcDilHlsSimplePlayer(url, playerElement, lcevcDilConfig);
30
</script>
31
</body>
32
</html>
Copied!
Last modified 5mo ago