Skip to content

Commit

Permalink
Add additional documentation for workerPath config (#5765)
Browse files Browse the repository at this point in the history
  • Loading branch information
mogzol committed Aug 28, 2023
1 parent e5e6e55 commit edcef9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Migrating from hls.js 1.x to 1.4+

The 1.4 version of hls.js now ships with an ESM version of the library (`dist/hls.mjs`) which requires that you specify the [`workerPath` config option](https://github.com/video-dev/hls.js/blob/master/docs/API.md#workerpath) in order for web workers to be used. This should point to the `dist/hls.worker.js` file included in the package.

If you are using the UMD version (`dist/hls.js`), no changes are required.

**Important Note:** If you are using a bundler, such as webpack, the ESM version of the package will likely be used by default. If this is the case, make sure to add the `workerPath` config option after upgrading to hls.js 1.4 or above.

# Migrating from hls.js 0.x to 1.x

This guide provides an overview to migrating an application using hls.js from v0.14.x to v1.0.0.
Expand Down
8 changes: 8 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,13 @@ Let's
<script>
if (Hls.isSupported()) {
var video = document.getElementById('video');
// If you are using the ESM version of the library (hls.mjs), you
// should specify the "workerPath" config option here if you want
// web workers to be used. Note that bundlers (such as webpack)
// will likely use the ESM version by default.
var hls = new Hls();
// bind them together
hls.attachMedia(video);
// MEDIA_ATTACHED event is fired by hls object once MediaSource is ready
Expand Down Expand Up @@ -669,6 +675,8 @@ Enable WebWorker (if available on browser) for TS demuxing/MP4 remuxing, to impr

Provide a path to hls.worker.js as an alternative to injecting the worker based on the iife library wrapper function. When `workerPath` is defined as a string, the transmuxer interface will initialize a WebWorker using the resolved `workerPath` URL.

When using the ESM version of the library (hls.mjs), this option is required in order for web workers to be used.

### `enableSoftwareAES`

(default: `true`)
Expand Down

0 comments on commit edcef9a

Please sign in to comment.