hls.js with LCEVC
The page outlines the steps needed to integrate the LCEVC decoder modifications to a player based on hls.js. V-Nova provides a reference integration with hls.js which can be referred to as you update your own hls.js player deployment.
Reference integration package
The reference integration packages contains a zip file with the following :
js/libs : These are all the files related to the player (hls.js).
js/VNova-LCEVC : All DIL.js Libraries need for LCEVC Enhancements. (dil.min.js, liblcevc_dpi.wasm) and patch file based on player to bridge the api calls to the player library(lcevc_dil_patch_hls.js).
js/app.js : This is the UI based operations with the demo UI that comes with the package.
index.html : Default demo page that showcases the decoding capabilities with LCEVC manifests in HLS and DASH based on the player, and provides a field to specify different stream manifest links for testing.
simple.html : The bare minimum integration that handles everything inside the patch.
integration.html : This explains a basic integration with a video, canvas and config passed to the dil libraries.
How to integrate LCEVC into an existing hls.js player
Step 1: To integrate LCEVC into an existing hls.js player, you need to include all the scripts under the "demo/js/VNova-LCEVC" folder.
Your HTML page should include the following scripts in the header:
Notes:
A version of "hls.js" will need to be included. Currently, version 1.0.4 is supported.
The file "lcevc_dil_patch_hls.js" should be included last, as this needs the other scripts to be loaded first.
All the VNova-LCEVC scripts must be present in the same folder, including "liblcevc_dpi.wasm".
Or it is also possible to reference these sources hosted in the AWS cloud by V-Nova. These are updated periodically to the latest versions:
Step 2: In the HTML, the code used to load the hls.js player must be modified slightly from its normal usage, to integrate the LCEVC enhancement decoding capabilities, as follows:
Code Changes
To check if hls.js is supported or not:
To create a new instantiation of hls.js:
To initialise LCEVC within the hls player:
The parameters are defined as follows:
canvas
This is an HTMLCanvasElement object and is used to display the rendered frames / output of the video after V-Nova LCEVC has been applied.
Its visibility, and pixel size are both controlled automatically by the player. Please note that the dimensions (in pixels) are set based on the size of the initial video and of the LCEVC-enhanced content being rendered. It is not guaranteed to always be a fixed size and may change dynamically.
The canvas element should mimic the screen size and page position of the video element, via the user’s CSS pixel size, however, this should not be forced, as it is controlled by the player.
The canvas element will be a WebGL canvas, and therefore it is not possible to use any of the HTML5 2D drawing context methods.
lcevcDilConfig
This is an object block containing settings with which V-Nova LCEVC is initialised. It is automatically configured with optimal settings.
Then just attach the video element as normal:
The video variable is an HTMLVideoElement object and contains the video, exactly as it would for the regular use of hls.js. Once V-Nova LCEVC has been loaded from the header data, this video element is automatically made invisible, using dynamic CSS. A canvas element is then used to display the rendered frames.
Autoplay when loaded:
LcevcDil.appendBuffer(data, type, level, timestampOffset)
data: The video buffer data.
type: The type of the data, can be
'video'
,'audio'
or'audiovideo'
.level: The current ABR profile/rendition/level ID of the data.
timestampOffset (optional): The offset that needs to be applied to all timestamps in the buffer.
Last updated