Skip to content

Commit

Permalink
Merge pull request #1400 from canalplus/feat/add-es5-worker
Browse files Browse the repository at this point in the history
Provide ES5 version of the worker file
  • Loading branch information
peaBerberian committed Mar 11, 2024
2 parents 04643cf + f2b56aa commit a8ec514
Show file tree
Hide file tree
Showing 13 changed files with 352 additions and 67 deletions.
29 changes: 29 additions & 0 deletions doc/api/Miscellaneous/MultiThreading.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,32 @@ if (currentModeInfo === null) {
console.info("We're running completely in main thread.");
}
```

## Note about ES5 Environment

By default, the Worker file will use es2017 features which should be compatible to a
majority of devices.

However, some older devices might not be compatible with it yet still compatible to the
WebWorker API (and thus the `MULTI_THREAD` feature), yet not with ES2017. For those
platforms, the RxPlayer also provide an ES5 variant of the Worker file:

- The easiest way is to just import in your application its "embedded" version, exported
through the `"rx-player/experimental/features/embeds"` path:

```js
import { EMBEDDED_WORKER_ES5 } from "rx-player/experimental/features/embeds";
```

This allows to bypass the need to store and serve separately that file.

If you would prefer more control and a smaller bundle size, you may instead consider the
other following ways to it as a separate file.

- With every release note published on GitHub as `worker.es5.js` (you should only use the
file linked to the RxPlayer's version you're using),

- It is also available as `dist/worker.es5.js` from the root directory of the project
published on npm. As such, it might already be found in your project's directory, for
example in the `node_modules` directory (most probably in `node_modules/rx-player/dist/`
depending on your project).
137 changes: 101 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@
"ts-jest": "29.1.1",
"ts-loader": "9.5.1",
"typescript": "5.3.3",
"webpack": "5.89.0",
"webpack-cli": "5.1.4"
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
},
"scripts-list": {
"Build a demo page (e.g. to test a code change)": {
Expand Down
Loading

0 comments on commit a8ec514

Please sign in to comment.