diff --git a/README.md b/README.md
index 5dae12051f..6ac29d5b23 100644
--- a/README.md
+++ b/README.md
@@ -148,14 +148,14 @@ HLS features **not** supported:
**Only supported on browsers with Media Source Extensions SourceBuffer support**
- - MPEG-5 Part2 LCEVC decoding support (decoding provided by [lcevc_dil.js][], must be
+ - MPEG-5 Part2 LCEVC decoding support (decoding provided by [lcevc_dec.js][], must be
separately included)
- Integration documentation : [docs](docs/design/lcevc-integration.md)
- More on [MPEG-5 Part2 LCEVC][]
-[lcevc_dil.js]: https://www.npmjs.com/package/lcevc_dil.js
+[lcevc_dec.js]: https://www.npmjs.com/package/lcevc_dec.js
[MPEG-5 Part2 LCEVC]: https://www.lcevc.org
diff --git a/build/types/lcevc b/build/types/lcevc
index df4a50a936..083ff02a88 100644
--- a/build/types/lcevc
+++ b/build/types/lcevc
@@ -1,3 +1,3 @@
# LCEVC library.
-+../../lib/lcevc/lcevc_dil.js
++../../lib/lcevc/lcevc_dec.js
diff --git a/demo/common/assets.js b/demo/common/assets.js
index 9cd06d545c..521a6cd7fd 100644
--- a/demo/common/assets.js
+++ b/demo/common/assets.js
@@ -1364,6 +1364,31 @@ shakaAssets.testAssets = [
/* source= */ shakaAssets.Source.VNOVA)
.addFeature(shakaAssets.Feature.DASH)
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
+ .addFeature(shakaAssets.Feature.MP2TS)
+ .addFeature(shakaAssets.Feature.OFFLINE)
+ .addFeature(shakaAssets.Feature.LCEVC)
+ .addDescription('LCEVC Enhanced eSports content selection.')
+ .setExtraConfig({
+ streaming: {
+ useNativeHlsOnSafari: false,
+ },
+ mediaSource: {
+ forceTransmux: true,
+ },
+ lcevc: {
+ enabled: true,
+ dynamicPerformanceScaling: true,
+ logLevel: 0,
+ drawLogo: false,
+ },
+ }),
+ new ShakaDemoAssetInfo(
+ /* name= */ 'Tears of Steel LCEVC H264 (HLS, MP4)',
+ /* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/tears_of_steel.png',
+ /* manifestUri= */ 'https://d3mfda3gpj3dw1.cloudfront.net/vn2LvEps745ShGtQ/master.m3u8',
+ /* source= */ shakaAssets.Source.VNOVA)
+ .addFeature(shakaAssets.Feature.HLS)
+ .addFeature(shakaAssets.Feature.HIGH_DEFINITION)
.addFeature(shakaAssets.Feature.MP4)
.addFeature(shakaAssets.Feature.OFFLINE)
.addFeature(shakaAssets.Feature.LCEVC)
diff --git a/demo/index.html b/demo/index.html
index c929f3fb90..f93f0a533b 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -39,7 +39,7 @@
-
+
diff --git a/docs/design/lcevc-integration.md b/docs/design/lcevc-integration.md
index fb7685dfc2..fba525ec9c 100644
--- a/docs/design/lcevc-integration.md
+++ b/docs/design/lcevc-integration.md
@@ -8,51 +8,51 @@ This article describes the V-Nova LCEVC Shaka Player integration.
# LCEVC Integration
## Adding V-Nova required files
-### Importing DIL - Decoder Integration Layer
+### Importing LCEVC Decoder
-V-Nova LCEVC DIL Libraries are included using the same approach that the other external libraries are currently using. The necessary V-Nova LCEVC DIL files need to be imported in the HTML page that is going to be used by Shaka Player to decode LCEVC. Checks are inplace that make sure the necessary objects are available.
+V-Nova LCEVC Decoder Libraries are included using the same approach that the other external libraries are currently using. The necessary V-Nova LCEVC Decoder files need to be imported in the HTML page that is going to be used by Shaka Player to decode LCEVC. Checks are inplace that make sure the necessary objects are available.
-Npm package :
+NPM package :
```javascript
-
+
```
-To allow the Closure compiler to use the objects and methods that are exported by the DIL.js a new `extern` is created.
+To allow the Closure compiler to use the objects and methods that are exported by the LCEVCdec.js a new `extern` is created.
### Defining an Extern for LCEVC
-`externs/lcevc.js` exposes the functions from the LCEVC DIL library required for LCEVC Decoding.
+`externs/lcevc.js` exposes the functions from the LCEVC Decoder library required for LCEVC Decoding.
## Integration point
-### The shaka.lcevc.Dil class - (DIL : Decoder Integration Layer)
+### The shaka.lcevc.Dec class - (DEC : Decoder)
-The main logic of the LCEVC integration is located in the `lib/lcevc_dil.min.js` file. In this file the shaka.lcevc.Dil is exported to be used in the project. This class is in charge of creating the Dil object using the mentioned externs, checking if LCEVC DIL library is available, etc.
+The main logic of the LCEVC integration is located in the `lib/lcevc_dec.min.js` file. In this file the shaka.lcevc.Dec is exported to be used in the project. This class is in charge of creating the Dec object using the mentioned externs, checking if LCEVC Decoder library is available, etc.
### Modifications in the player
The shaka.Player class, defined in the `lib/player.js` file, is the main player object for Shaka Player. There is a setter function for setting up a `canvas` element that is received from the user.
If shaka.ui is used the `canvas` is created in line with the video element in the same container overlaying the video element. If user provides a custom canvas using the setter function, The user is responsible for placing the canvas element in the desired position and resizing it.
-`shaka.externs.LcevcConfiguration` is added to the `playerConfiguration` that is used as configuration for the LCEVC DIL Library.
+`shaka.externs.LcevcConfiguration` is added to the `playerConfiguration` that is used as configuration for the LCEVC Decoder Library.
-The Dil object is created in the `onLoad_()` event that is triggered when a new video is loaded in Shaka Player. Attaching to a media element is defined as:
+The Dec object is created in the `onLoad_()` event that is triggered when a new video is loaded in Shaka Player. Attaching to a media element is defined as:
- Registering error listeners to the media element.
- Catching the video element for use outside of the load graph.
-The Dil object is created only if LCEVC is supported (LCEVC libs are loaded on the page) and also when it was not already created in another `onLoad_()` event execution.
+The LCEVC Decoder object is created only if LCEVC is supported (LCEVC libs are loaded on the page) and also when it was not already created in another `onLoad_()` event execution.
-### Feeding the Dil
+### Feeding the Dec
The logic that Shaka Player uses to communicate with the Media Source Extensions (MSE) is located in the `media/media_source_engine.js` file.
![image.png](lcevc-architecture.png)
- `append_()` function that is used to feed the MSE Source Buffer is intercepted and modified to pass the video buffers to the LCEVC DIL Libraries before appending to the MSE Source Buffers.
+ `append_()` function that is used to feed the MSE Source Buffer is intercepted and modified to pass the video buffers and related time offsets to the LCEVC Decoder Libraries before appending to the MSE Source Buffers.
## Demo page
@@ -60,7 +60,7 @@ The relevant libraries are added in the Demo Page like so:
```javascript
-
+
```
And a new video sample with enhancement data is added to the `demo/common/assets.js` file under a new source `MPEG-5 Part 2 LCEVC`.
diff --git a/docs/tutorials/index.json b/docs/tutorials/index.json
index 34578e9094..a7f2a6d6eb 100644
--- a/docs/tutorials/index.json
+++ b/docs/tutorials/index.json
@@ -24,5 +24,6 @@
{ "selenium-grid-config": { "title": "Selenium Grid Config" } },
{ "faq": { "title": "Frequently Asked Questions" } },
{ "upgrade": { "title": "Upgrade Guide" } },
- { "upgrade-manifest": { "title": "ManifestParser Upgrade Guide" } }
+ { "upgrade-manifest": { "title": "ManifestParser Upgrade Guide" } },
+ { "lcevc": { "title": "LCEVC Quick Start" } }
]
diff --git a/docs/tutorials/lcevc.md b/docs/tutorials/lcevc.md
new file mode 100644
index 0000000000..6632df4744
--- /dev/null
+++ b/docs/tutorials/lcevc.md
@@ -0,0 +1,118 @@
+# LCEVC Quick Start
+
+#### Requirements
+
+ - Only supported on browsers with Media Source Extensions SourceBuffer support
+
+ - MPEG-5 Part2 LCEVC decoding support (decoding provided by [lcevc_dec.js][],
+ must be separately included)
+
+##### Integration documentation : [docs](../design/lcevc-integration.md)
+
+##### More on [MPEG-5 Part2 LCEVC][]
+
+[lcevc_dec.js]: https://www.npmjs.com/package/lcevc_dec.js?activeTab=readme
+[MPEG-5 Part2 LCEVC]: https://www.lcevc.org
+
+#### Configure LCEVC
+
+LCEVC Decoder library needs to be included in the HTML page:
+
+- Local `npm install lcevc_dec.js`
+```html
+
+```
+- Or use `unpkg.com` for latest LCEVC Decoder libraries.
+```html
+
+```
+
+Configuration to enable LCEVC enhancement:
+```js
+player.configure('lcevc.enabled', true);
+```
+
+#### LCEVC setup via UI library
+
+Sample setup using the Shaka Player UI library:
+
+```html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+```js
+// app.js
+
+const manifestUri = 'https://dyctis843rxh5.cloudfront.net/vnIAZIaowG1K7qOt/master.m3u8';
+
+// Initialise Shaka Player with LCEVC enhancement.
+async function init() {
+ // When using the UI, the player is made automatically by the UI object.
+ const video = document.getElementById('video');
+ const ui = video['ui'];
+ const controls = ui.getControls();
+ const player = controls.getPlayer();
+
+ // Enable the LCEVC enhancement.
+ player.configure('lcevc.enabled', true);
+
+ // Listen for error events.
+ player.addEventListener('error', onError);
+ controls.addEventListener('error', onError);
+
+ // Try to load a manifest.
+ // This is an asynchronous process.
+ try {
+ await player.load(manifestUri);
+ // This runs if the asynchronous load is successful.
+ console.log('The video has now been loaded!');
+ } catch (error) {
+ onError(error);
+ }
+}
+
+// Handle errors.
+function onError(error) {
+ console.error('Error', error);
+}
+
+// Listen to the custom shaka-ui-loaded event, to wait until the UI is loaded.
+document.addEventListener('shaka-ui-loaded', init);
+// Listen to the custom shaka-ui-load-failed event, in case Shaka Player fails
+// to load (e.g. due to lack of browser support).
+document.addEventListener('shaka-ui-load-failed', onError);
+
+```
+
+#### User provided canvas
+
+User can also provide a canvas to the player though `attachCanvas` function:
+
+```js
+player.attachCanvas(canvas);
+```
+
+Note: If external canvas is used, user is responsible for managing
+the canvas. If no canvas is provided for Shaka UI library, the player
+will generate and manage the canvas.
diff --git a/externs/lcevc.js b/externs/lcevc.js
index 9dae061e95..c816df2a33 100644
--- a/externs/lcevc.js
+++ b/externs/lcevc.js
@@ -1,25 +1,27 @@
/**
-* @fileoverview Externs for LcevcDil
+* @fileoverview Externs for LcevcDec
* compiler.
*
* @externs
*/
-// This empty namespace is declared to check if LcevcDil libraries are loaded.
+// This empty namespace is declared to check if LcevcDec libraries are loaded.
+/** @const */
var libDPIModule = {};
-var LcevcDil = {};
+/** @const */
+var LCEVCdec = {};
/**
-* LCEVC DIL constructor
+* LCEVC Dec constructor
* @constructor
*/
-LcevcDil.LcevcDIL = class {
+LCEVCdec.LCEVCdec = class {
/**
* @param {HTMLVideoElement} media
* @param {HTMLCanvasElement} canvas
- * @param {shaka.extern.LcevcConfiguration} dilConfig
+ * @param {shaka.extern.LcevcConfiguration} lcevcConfig
*/
- constructor(media, canvas, dilConfig) {
+ constructor(media, canvas, lcevcConfig) {
}
/**
@@ -30,13 +32,14 @@ LcevcDil.LcevcDIL = class {
* @param {!BufferSource} data Video Buffer Data.
* @param {string} type Type of Video Buffer Data.
* @param {number} variantId Variant that the fragment belongs to.
+ * @param {number} timestampOffset Timestamp offset for appended segments
*/
- appendBuffer(data, type, variantId) {}
+ appendBuffer(data, type, variantId, timestampOffset) {}
/**
* Set current variant as variantId to the LCEVC decoder
* @param {!number} variantId
- * @param {!boolean} autoBufferSwitch is lcevcDil mode that switches variant
+ * @param {!boolean} autoBufferSwitch is lcevcDec mode that switches variant
* when the downloaded buffer from last variant has finished playing and
* buffers from the new variant starts to play.
*/
@@ -49,15 +52,28 @@ LcevcDil.LcevcDIL = class {
setContainerFormat(containerFormat) {}
/**
- * Close LCEVC DIL
+ * Set streaming Format for LCEVC Data Parsing.
+ * @param {!number} streamingFormat container type of the stream.
+ */
+ setStreamingFormat(streamingFormat) {}
+
+ /**
+ * Close LCEVC DEC
*/
close() {}
};
+/**
+ * The older module interface, for backward compatibility.
+ * Typed to the same interface, but under a different name.
+ * @type {typeof LCEVCdec.LCEVCdec}
+ */
+LCEVCdec.LcevcDil;
+
/**
* LCEVC Support Check
*/
-LcevcDil.SupportObject = {
+LCEVCdec.SupportObject = {
/**
* Check if canvas has WebGL support
@@ -72,10 +88,18 @@ LcevcDil.SupportObject = {
* LCEVC Support Checklist Result
* @type {boolean}
*/
-LcevcDil.SupportObject.SupportStatus;
+LCEVCdec.SupportObject.SupportStatus;
/**
* LCEVC Support CheckList Error if any.
* @type {string}
*/
-LcevcDil.SupportObject.SupportError;
+LCEVCdec.SupportObject.SupportError;
+
+/**
+ * Typedef for the module interface. Both LCEVCdec (new module) and LcevcDil
+ * (old module) implement roughly the same interface.
+ *
+ * @typedef {typeof LCEVCdec}
+ */
+var LCEVCmodule;
diff --git a/lib/lcevc/lcevc_dec.js b/lib/lcevc/lcevc_dec.js
new file mode 100644
index 0000000000..f28d3a3244
--- /dev/null
+++ b/lib/lcevc/lcevc_dec.js
@@ -0,0 +1,220 @@
+/*! @license
+ * Shaka Player
+ * Copyright 2016 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+goog.provide('shaka.lcevc.Dec');
+goog.require('shaka.log');
+goog.require('shaka.Deprecate');
+goog.require('shaka.util.IReleasable');
+
+/**
+ * @summary
+ * lcevcDec - (MPEG-5 Part 2 LCEVC - Decoder) provides
+ * all the operations related to the enhancement and rendering
+ * of LCEVC enabled streams and on to a canvas.
+ * @implements {shaka.util.IReleasable}
+ * @export
+ */
+shaka.lcevc.Dec = class {
+ /**
+ * @param {HTMLVideoElement} media The video element that will be attached to
+ * LCEVC Decoder for input.
+ * @param {HTMLCanvasElement} canvas The canvas element that will be attached
+ * to LCEVC Decoder to render the enhanced frames.
+ * @param {shaka.extern.LcevcConfiguration} lcevcConfig LCEVC configuration
+ * object to initialize the LCEVC Decoder.
+ */
+ constructor(media, canvas, lcevcConfig) {
+ /**
+ * LCEVC Decoder library based on availability, to check if either
+ * lcevc_dil or lcevc_dec is present.
+ * @private {LCEVCmodule}
+ */
+ this.lcevcLib_;
+
+ /** @private {?LCEVCdec.LCEVCdec} */
+ this.dec_ = null;
+
+ /** @private {number} */
+ this.variantId_ = -1;
+
+ /** @private {HTMLVideoElement} */
+ this.media_ = media;
+
+ /** @private {HTMLCanvasElement} */
+ this.canvas_ = canvas;
+
+ /** @private {shaka.extern.LcevcConfiguration} */
+ this.decConfig_ = lcevcConfig;
+
+ /** @private {boolean} */
+ this.toBeDeprecated_ = false;
+
+ this.create_();
+ }
+
+ /**
+ * Append data to the LCEVC Dec.
+ * @param {BufferSource} data
+ * @param {number} timestampOffset
+ */
+ appendBuffer(data, timestampOffset) {
+ if (this.dec_) {
+ // Timestamp offset describes how much offset should be applied to the
+ // LCEVC enhancement to match the decoded video frame, as such it needs
+ // to be negated.
+ this.dec_.appendBuffer(data, 'video', this.variantId_, -timestampOffset);
+ }
+ }
+
+ /**
+ * Hide the canvas specifically in the case of a DRM Content
+ */
+ hideCanvas() {
+ if (this.dec_) {
+ this.canvas_.classList.add('shaka-hidden');
+ }
+ }
+
+ /**
+ * Create LCEVC Decoder.
+ * @private
+ */
+ create_() {
+ if (this.isSupported_() && !this.dec_) {
+ if (this.lcevcLib_.SupportObject.webGLSupport(this.canvas_)) {
+ // Make sure the canvas is not hidden from a previous playback session.
+ this.canvas_.classList.remove('shaka-hidden');
+ // Initiate LCEVC Dec Library based on the type of module available.
+ if (this.toBeDeprecated_) {
+ this.dec_ = new this.lcevcLib_.LcevcDil(
+ this.media_,
+ this.canvas_,
+ this.decConfig_);
+ } else {
+ this.dec_ = new this.lcevcLib_.LCEVCdec(
+ this.media_,
+ this.canvas_,
+ this.decConfig_);
+ }
+ }
+ }
+ }
+
+ /**
+ * Close LCEVC Decoder.
+ * @override
+ * @export
+ */
+ release() {
+ if (this.dec_) {
+ this.dec_.close();
+ this.dec_ = null;
+ }
+ }
+
+ /**
+ * Check if the LCEVC Decoder lib is present and is supported by the browser.
+ * @return {boolean}
+ * @private
+ */
+ isSupported_() {
+ if (typeof libDPIModule === 'undefined') {
+ shaka.log.alwaysWarn(
+ 'Could not find LCEVC Library dependencies on this page');
+ }
+
+ // This is a check to make the LCEVC Dec Integration is backwards compatible
+ // with previous Integration. This logic checks for both implementations
+ // and uses the one available.
+ if (typeof LCEVCdec !== 'undefined') {
+ this.lcevcLib_ = LCEVCdec;
+ } else {
+ if (typeof LcevcDil !== 'undefined') {
+ this.lcevcLib_ = LcevcDil;
+ this.toBeDeprecated_ = true;
+ shaka.Deprecate.deprecateFeature(5,
+ 'LcevcDil',
+ 'lcevc_dil.js is deprecated, please use lcevc_dec.js instead');
+ } else {
+ shaka.log.alwaysWarn('Could not find LCEVC Library on this page');
+ return false;
+ }
+ }
+
+ // Making Sure if there is a valid LCEVC Dec Library exists.
+ if (typeof this.lcevcLib_.SupportObject === 'undefined') {
+ shaka.log.alwaysWarn('Could not find LCEVC Library on this page');
+ return false;
+ } else {
+ if (!this.lcevcLib_.SupportObject.SupportStatus) {
+ shaka.log.alwaysWarn(this.lcevcLib_.SupportObject.SupportError);
+ }
+ }
+
+ return typeof this.lcevcLib_ !== 'undefined' &&
+ typeof libDPIModule !== 'undefined' &&
+ this.canvas_ instanceof HTMLCanvasElement &&
+ this.lcevcLib_.SupportObject.SupportStatus;
+ }
+
+ /**
+ * Update current active variant
+ * @param {shaka.extern.Track} track
+ */
+ updateVariant(track, manifestType) {
+ let containerFormat = shaka.lcevc.Dec.ContainerFormat.MPEG2_TS;
+ let streamingFormat = shaka.lcevc.Dec.StreamingFormat.OTHER;
+ switch (track.mimeType) {
+ case 'video/webm': {
+ containerFormat = shaka.lcevc.Dec.ContainerFormat.WEBM;
+ break;
+ }
+ case 'video/mp4': {
+ containerFormat = shaka.lcevc.Dec.ContainerFormat.MP4;
+ break;
+ }
+ }
+ switch (manifestType) {
+ case 'DASH': {
+ streamingFormat = shaka.lcevc.Dec.StreamingFormat.DASH;
+ break;
+ }
+ case 'HLS': {
+ streamingFormat = shaka.lcevc.Dec.StreamingFormat.HLS;
+ break;
+ }
+ }
+ if (this.dec_) {
+ this.variantId_ = track.id;
+ this.dec_.setLevelSwitching(track.id, true);
+ this.dec_.setContainerFormat(containerFormat);
+ // This functionality is only available on the LCEVC Dec Library.
+ if (!this.toBeDeprecated_) {
+ this.dec_.setStreamingFormat(streamingFormat);
+ }
+ }
+ }
+};
+
+/**
+ * Container Formats.
+ * @const @enum {number}
+ */
+shaka.lcevc.Dec.ContainerFormat = {
+ MPEG2_TS: 0,
+ WEBM: 1,
+ MP4: 2,
+};
+
+/**
+ * Streaming Formats.
+ * @const @enum {number}
+ */
+shaka.lcevc.Dec.StreamingFormat = {
+ HLS: 0,
+ DASH: 1,
+ OTHER: -1,
+};
diff --git a/lib/lcevc/lcevc_dil.js b/lib/lcevc/lcevc_dil.js
deleted file mode 100644
index e9f4805c6c..0000000000
--- a/lib/lcevc/lcevc_dil.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/*! @license
- * Shaka Player
- * Copyright 2016 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-
-goog.provide('shaka.lcevc.Dil');
-goog.require('shaka.log');
-goog.require('shaka.util.IReleasable');
-
-/**
- * @summary
- * lcevcDil - (MPEG-5 Part 2 LCEVC - Decoder Integration Layer) provides
- * all the operations related to the enhancement and rendering
- * of LCEVC enabled streams and on to a canvas.
- * @implements {shaka.util.IReleasable}
- * @export
- */
-shaka.lcevc.Dil = class {
- /**
- * @param {HTMLVideoElement} media The video element that will be attached to
- * LCEVC Dil for input.
- * @param {HTMLCanvasElement} canvas The canvas element that will be attached
- * to LCEVC Dil to render the enhanced frames.
- * @param {shaka.extern.LcevcConfiguration} dilConfig The LCEVC DIL
- * config object to initialize the LCEVC DIL.
- */
- constructor(media, canvas, dilConfig) {
- /** @private {?LcevcDil.LcevcDIL} */
- this.dil_ = null;
-
- /** @private {number} */
- this.variantId_ = -1;
-
- /** @private {HTMLVideoElement} */
- this.media_ = media;
-
- /** @private {HTMLCanvasElement} */
- this.canvas_ = canvas;
-
- /** @private {shaka.extern.LcevcConfiguration} */
- this.dilConfig_ = dilConfig;
-
- this.create_();
- }
-
- /**
- * Append data to the LCEVC Dil.
- * @param {BufferSource} data
- */
- appendBuffer(data) {
- if (this.dil_) {
- this.dil_.appendBuffer(data, 'video', this.variantId_);
- }
- }
-
- /**
- * Hide the canvas specifically in the case of a DRM Content
- */
- hideCanvas() {
- if (this.dil_) {
- this.canvas_.classList.add('shaka-hidden');
- }
- }
-
- /**
- * Create LCEVC Dil.
- * @private
- */
- create_() {
- if (this.isSupported_() && !this.dil_) {
- if (LcevcDil.SupportObject.webGLSupport(this.canvas_)) {
- // Make sure the canvas is not hidden from a previous playback session.
- this.canvas_.classList.remove('shaka-hidden');
- this.dil_ = new LcevcDil.LcevcDil(
- this.media_,
- this.canvas_,
- this.dilConfig_);
- }
- }
- }
-
- /**
- * Close LCEVC Dil.
- * @override
- * @export
- */
- release() {
- if (this.dil_) {
- this.dil_.close();
- this.dil_ = null;
- }
- }
-
- /**
- * Check if the LCEVC Dil lib is present and is supported by the browser.
- * @return {boolean}
- * @private
- */
- isSupported_() {
- if (typeof libDPIModule === 'undefined') {
- shaka.log.alwaysWarn(
- 'Could not Find LCEVC Library dependencies on this page');
- }
-
- if (typeof LcevcDil === 'undefined') {
- shaka.log.alwaysWarn('Could not Find LCEVC Library on this page');
- } else {
- if (!LcevcDil.SupportObject.SupportStatus) {
- shaka.log.alwaysWarn(LcevcDil.SupportObject.SupportError);
- }
- }
-
- return typeof LcevcDil !== 'undefined' &&
- typeof libDPIModule !== 'undefined' &&
- this.canvas_ instanceof HTMLCanvasElement &&
- LcevcDil.SupportObject.SupportStatus;
- }
-
- /**
- * Update current active variant
- * @param {shaka.extern.Track} track
- */
- updateVariant(track) {
- let containerFormat = shaka.lcevc.Dil.ContainerFormat.MPEG2_TS;
- switch (track.mimeType) {
- case 'video/webm': {
- containerFormat = shaka.lcevc.Dil.ContainerFormat.WEBM;
- break;
- }
- case 'video/mp4': {
- containerFormat = shaka.lcevc.Dil.ContainerFormat.MP4;
- break;
- }
- }
- if (this.dil_) {
- this.variantId_ = track.id;
- this.dil_.setLevelSwitching(track.id, true);
- this.dil_.setContainerFormat(containerFormat);
- }
- }
-};
-
-/**
- * Container Formats.
- * @const @enum {number}
- */
-shaka.lcevc.Dil.ContainerFormat = {
- MPEG2_TS: 0,
- WEBM: 1,
- MP4: 2,
-};
diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js
index 00053f6f7c..f2fabda61e 100644
--- a/lib/media/media_source_engine.js
+++ b/lib/media/media_source_engine.js
@@ -31,7 +31,7 @@ goog.require('shaka.util.Mp4Parser');
goog.require('shaka.util.Platform');
goog.require('shaka.util.PublicPromise');
goog.require('shaka.util.TsParser');
-goog.require('shaka.lcevc.Dil');
+goog.require('shaka.lcevc.Dec');
/**
@@ -53,10 +53,10 @@ shaka.media.MediaSourceEngine = class {
* MediaSourceEngine is destroyed, it will destroy the displayer.
* @param {!function(!Array., number, ?number)=}
* onMetadata
- * @param {?shaka.lcevc.Dil} [lcevcDil] Optional - LCEVC Dil Object
+ * @param {?shaka.lcevc.Dec} [lcevcDec] Optional - LCEVC Decoder Object
*
*/
- constructor(video, textDisplayer, onMetadata, lcevcDil) {
+ constructor(video, textDisplayer, onMetadata, lcevcDec) {
/** @private {HTMLMediaElement} */
this.video_ = video;
@@ -91,8 +91,8 @@ shaka.media.MediaSourceEngine = class {
number, ?number)} */
this.onMetadata_ = onMetadata || onMetadataNoOp;
- /** @private {?shaka.lcevc.Dil} */
- this.lcevcDil_ = lcevcDil || null;
+ /** @private {?shaka.lcevc.Dec} */
+ this.lcevcDec_ = lcevcDec || null;
/**
* @private {!Object. {
this.processTimedMetadataMediaSrc_(metadata, offset, endTime);
},
- this.lcevcDil_);
+ this.lcevcDec_);
mediaSourceEngine.configure(this.config_.mediaSource);
const {segmentRelativeVttTiming} = this.config_.manifest;
mediaSourceEngine.setSegmentRelativeVttTiming(segmentRelativeVttTiming);
@@ -2045,8 +2046,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
// the enhancement. In DRM contexts where the browser CDM restricts
// access from our decoder, the enhancement cannot be applied and
// therefore the LCEVC output canvas is hidden accordingly.
- if (this.lcevcDil_) {
- this.lcevcDil_.hideCanvas();
+ if (this.lcevcDec_) {
+ this.lcevcDec_.hideCanvas();
}
}
},
@@ -2132,7 +2133,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
this.loadEventManager_.listen(mediaElement, 'ended', updateStateHistory);
this.loadEventManager_.listen(mediaElement, 'ratechange', onRateChange);
- // Check status of the LCEVC DIL Object and reset or
+ // Check status of the LCEVC Dec Object and reset or
// create or close based on config
this.setupLcevc_(this.config_);
@@ -3146,16 +3147,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
* @param {!shaka.extern.TextDisplayer} textDisplayer
* @param {!function(!Array., number, ?number)}
* onMetadata
- * @param {shaka.lcevc.Dil} lcevcDil
+ * @param {shaka.lcevc.Dec} lcevcDec
*
* @return {!shaka.media.MediaSourceEngine}
*/
- createMediaSourceEngine(mediaElement, textDisplayer, onMetadata, lcevcDil) {
+ createMediaSourceEngine(mediaElement, textDisplayer, onMetadata, lcevcDec) {
return new shaka.media.MediaSourceEngine(
mediaElement,
textDisplayer,
onMetadata,
- lcevcDil);
+ lcevcDec);
}
/**
@@ -6206,8 +6207,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
const data = new Map()
.set('oldTrack', from)
.set('newTrack', to);
- if (this.lcevcDil_) {
- this.lcevcDil_.updateVariant(to);
+ if (this.lcevcDec_) {
+ this.lcevcDec_.updateVariant(to, this.getManifestType());
}
const event =
this.makeEvent_(shaka.util.FakeEvent.EventName.Adaptation, data);
@@ -6237,8 +6238,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
const data = new Map()
.set('oldTrack', from)
.set('newTrack', to);
- if (this.lcevcDil_) {
- this.lcevcDil_.updateVariant(to);
+ if (this.lcevcDec_) {
+ this.lcevcDec_.updateVariant(to, this.getManifestType());
}
const event =
diff --git a/package-lock.json b/package-lock.json
index 81a8758011..4dc1484480 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -49,7 +49,7 @@
"karma-sourcemap-loader": "^0.3.8",
"karma-spec-reporter": "^0.0.34",
"karma-webdriver-launcher": "^1.0.8",
- "lcevc_dil.js": "^1.1.20",
+ "lcevc_dec.js": "^1.0.0",
"less": "https://gitpkg.now.sh/joeyparrish/less.js/packages/less?28c63a43",
"less-plugin-clean-css": "github:austingardner/less-plugin-clean-css#4e9e77bf",
"material-design-lite": "^1.3.0",
@@ -5766,10 +5766,10 @@
"safe-buffer": "~5.1.0"
}
},
- "node_modules/lcevc_dil.js": {
- "version": "1.1.20",
- "resolved": "https://registry.npmjs.org/lcevc_dil.js/-/lcevc_dil.js-1.1.20.tgz",
- "integrity": "sha512-SAAWfAkfVIhyYm1Jgq9EuPWXT9Gw+/kjCdtEEa9cWah01n3K3DpVxqdruitt6ZSu2uurmNPU2wPfqmfFLF97Og==",
+ "node_modules/lcevc_dec.js": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lcevc_dec.js/-/lcevc_dec.js-1.0.0.tgz",
+ "integrity": "sha512-SYRmIbroLdn2QkEEQegVElv9yXzrg5srhMQeZIpufIFvpdoSoJmKlGSAdFMHoZcFqsd2Qy/Yjwe5vxvHkkZquA==",
"dev": true,
"dependencies": {
"git-rev-sync": "^3.0.1"
@@ -7181,7 +7181,7 @@
"node_modules/rechoir": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
- "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+ "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==",
"dev": true,
"dependencies": {
"resolve": "^1.1.6"
@@ -13116,10 +13116,10 @@
}
}
},
- "lcevc_dil.js": {
- "version": "1.1.20",
- "resolved": "https://registry.npmjs.org/lcevc_dil.js/-/lcevc_dil.js-1.1.20.tgz",
- "integrity": "sha512-SAAWfAkfVIhyYm1Jgq9EuPWXT9Gw+/kjCdtEEa9cWah01n3K3DpVxqdruitt6ZSu2uurmNPU2wPfqmfFLF97Og==",
+ "lcevc_dec.js": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lcevc_dec.js/-/lcevc_dec.js-1.0.0.tgz",
+ "integrity": "sha512-SYRmIbroLdn2QkEEQegVElv9yXzrg5srhMQeZIpufIFvpdoSoJmKlGSAdFMHoZcFqsd2Qy/Yjwe5vxvHkkZquA==",
"dev": true,
"requires": {
"git-rev-sync": "^3.0.1"
@@ -14182,7 +14182,7 @@
"rechoir": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
- "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+ "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==",
"dev": true,
"requires": {
"resolve": "^1.1.6"
diff --git a/package.json b/package.json
index fa2fa57100..58905d96f9 100644
--- a/package.json
+++ b/package.json
@@ -48,7 +48,7 @@
"karma-sourcemap-loader": "^0.3.8",
"karma-spec-reporter": "^0.0.34",
"karma-webdriver-launcher": "^1.0.8",
- "lcevc_dil.js": "^1.1.20",
+ "lcevc_dec.js": "^1.0.0",
"less": "https://gitpkg.now.sh/joeyparrish/less.js/packages/less?28c63a43",
"less-plugin-clean-css": "github:austingardner/less-plugin-clean-css#4e9e77bf",
"material-design-lite": "^1.3.0",
@@ -74,8 +74,8 @@
"eme-encryption-scheme-polyfill/index.js",
"es6-promise-polyfill/promise.min.js",
"google-closure-library/closure/goog/base.js",
- "lcevc_dil.js/dist/lcevc_dil.min.js",
- "lcevc_dil.js/dist/liblcevc_dpi.wasm",
+ "lcevc_dec.js/dist/lcevc_dec.min.js",
+ "lcevc_dec.js/dist/liblcevc_dpi.wasm",
"less/dist/less.js",
"material-design-lite/dist/material.indigo-blue.min.css",
"material-design-lite/dist/material.min.js",
diff --git a/test/player_unit.js b/test/player_unit.js
index 45b942a4e0..4d410c4406 100644
--- a/test/player_unit.js
+++ b/test/player_unit.js
@@ -128,8 +128,8 @@ describe('Player', () => {
getUseEmbeddedText: jasmine.createSpy('getUseEmbeddedText'),
setSegmentRelativeVttTiming:
jasmine.createSpy('setSegmentRelativeVttTiming'),
- updateLcevcDil:
- jasmine.createSpy('updateLcevcDil'),
+ updateLcevcDec:
+ jasmine.createSpy('updateLcevcDec'),
getTextDisplayer: () => textDisplayer,
getBufferedInfo: () => bufferedInfo,
ended: jasmine.createSpy('ended').and.returnValue(false),
diff --git a/test/test/util/fake_media_source_engine.js b/test/test/util/fake_media_source_engine.js
index 97980861c9..7d870a314d 100644
--- a/test/test/util/fake_media_source_engine.js
+++ b/test/test/util/fake_media_source_engine.js
@@ -134,8 +134,8 @@ shaka.test.FakeMediaSourceEngine = class {
jasmine.createSpy('setSegmentRelativeVttTiming').and.stub();
/** @type {!jasmine.Spy} */
- this.updateLcevcDil =
- jasmine.createSpy('updateLcevcDil').and.stub();
+ this.updateLcevcDec =
+ jasmine.createSpy('updateLcevcDec').and.stub();
/** @type {!jasmine.Spy} */
this.resync=