@theoplayer/web-ui 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # THEOplayer Web UI
1
+ # THEOplayer Open Video UI for Web
2
2
 
3
3
  A component library for building a world-class video player experience powered by
4
4
  the [THEOplayer Web SDK](https://www.theoplayer.com/product/theoplayer).
@@ -20,10 +20,10 @@ The current THEOplayer Web SDK comes with a built-in UI based on [video.js](http
20
20
 
21
21
  - Designed with customization in mind. With the old UI, customizing anything beyond changing some text and icon colors was difficult, and could break in unpredictable ways when updating to a new THEOplayer version. With the new UI, all components can be customized in a variety of ways with well-documented attributes and CSS custom properties.
22
22
  - Built for the modern web. The old UI was built at a time when Internet Explorer was still a major browser, so it couldn't use newer web technologies. The new UI breaks with the past and takes full advantage of Web Components, so it works well in modern web apps.
23
- - Developed in the open. Although the old UI is based on the open-source video.js library, any custom components bundled with THEOplayer remained closed-source. With the new UI, the source code of all components is publicly available. Advanced users can learn about the inner workings of each component, modify them, and even contribute their changes back to THEOplayer Web UI.
23
+ - Developed in the open. Although the old UI is based on the open-source video.js library, any custom components bundled with THEOplayer remained closed-source. With the new UI, the source code of all components is publicly available. Advanced users can learn about the inner workings of each component, modify them, and even contribute their changes back to Open Video UI.
24
24
 
25
25
  > **Note**
26
- > THEOplayer Web UI currently exists separately from the old THEOplayer UI. In the future, we hope to deprecate and remove the old UI, and ship this new UI as default UI for the THEOplayer Web SDK.
26
+ > THEOplayer Open Video UI for Web currently exists separately from the old THEOplayer UI. In the future, we hope to deprecate and remove the old UI, and ship this new UI as default UI for the THEOplayer Web SDK.
27
27
 
28
28
  ## Installation
29
29
 
@@ -35,22 +35,35 @@ The current THEOplayer Web SDK comes with a built-in UI based on [video.js](http
35
35
  ```sh
36
36
  npm install theoplayer@npm:@theoplayer/basic-hls
37
37
  ```
38
- 2. Install the THEOplayer Web UI.
38
+ 2. Install the Open Video UI for Web.
39
39
  ```sh
40
40
  npm install @theoplayer/web-ui
41
41
  ```
42
42
  3. Add `@theoplayer/web-ui` to your app:
43
43
  - Option 1: in your HTML.
44
44
  ```html
45
+ <script src="/path/to/node_modules/theoplayer/THEOplayer.chromeless.js"></script>
45
46
  <script src="/path/to/node_modules/@theoplayer/web-ui/dist/THEOplayerUI.js"></script>
46
47
  ```
47
48
  - Option 2: in your JavaScript.
48
49
  ```js
49
50
  import { DefaultUI } from '@theoplayer/web-ui';
50
51
  ```
51
-
52
- > **Warning**
53
- > THEOplayer Web SDK currently only supports being loaded through a regular `<script>` tag or as a [UMD module](https://github.com/umdjs/umd), and does not support being `import`ed as a native JavaScript module. If you use `import` with THEOplayer Web UI, make sure to use a JavaScript bundler such as Webpack or Rollup to include THEOplayer in your app. We're hoping to fix this incompatibility soon.
52
+ Open Video UI will import THEOplayer from `theoplayer/chromeless`.
53
+ If you're using a bundler such as Webpack or Rollup, this dependency should automatically get bundled with your web app.
54
+ Alternatively, you can use an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) to let the browser resolve it:
55
+ ```html
56
+ <script type="importmap">
57
+ {
58
+ "imports": {
59
+ "theoplayer/chromeless": "/path/to/node_modules/theoplayer/THEOplayer.chromeless.esm.js"
60
+ }
61
+ }
62
+ </script>
63
+ <!-- Import maps polyfill for browsers without import maps support (e.g. Safari 16.3) -->
64
+ <script async src="https://ga.jspm.io/npm:es-module-shims@1.8.0/dist/es-module-shims.js" crossorigin="anonymous"></script>
65
+ <script type="module" src="/path/to/my_app.js"></script>
66
+ ```
54
67
 
55
68
  ## Usage
56
69
 
@@ -114,23 +127,33 @@ See [docs/examples/custom-ui.html](https://github.com/THEOplayer/web-ui/blob/mai
114
127
 
115
128
  # Legacy browser support
116
129
 
117
- By default, THEOplayer Web UI targets modern browsers that support modern JavaScript syntax (such as [async/await](https://caniuse.com/async-functions)) and native [Custom Elements](https://caniuse.com/custom-elementsv1). This keeps the download size small, so your viewers can spend less time waiting for your page to load and start watching their video faster.
130
+ By default, Open Video UI for Web targets modern browsers that support modern JavaScript syntax (such as [async/await](https://caniuse.com/async-functions)) and native [Custom Elements](https://caniuse.com/custom-elementsv1). This keeps the download size small, so your viewers can spend less time waiting for your page to load and start watching their video faster.
118
131
 
119
- On older browsers (such as Internet Explorer 11 and older smart TVs), you need to load a different version of the THEOplayer Web UI that uses older JavaScript syntax. You also need to load additional polyfills for missing features such as Promises or Custom Elements. We recommend [Polyfill.io](https://polyfill.io/) and [Web Components Polyfills](https://github.com/webcomponents/polyfills) for these.
132
+ On older browsers (such as Internet Explorer 11 and older smart TVs), you need to load a different version of the Open Video UI that uses older JavaScript syntax. You also need to load additional polyfills for missing features such as Promises or Custom Elements. We recommend [Polyfill.io](https://polyfill.io/) and [Web Components Polyfills](https://github.com/webcomponents/polyfills) for these.
120
133
 
121
- - Option 1: in your HTML. This uses [differential serving](https://css-tricks.com/differential-serving/) so modern browsers will load the modern build (with `type="module"`, while legacy browsers will load the legacy build (with `nomodule`).
134
+ - Option 1: in your HTML. This uses [differential serving](https://css-tricks.com/differential-serving/) so modern browsers will load the modern build (with `type="module"`), while legacy browsers will load the legacy build (with `nomodule`).
122
135
 
123
136
  ```html
124
- <!-- Load polyfills -->
137
+ <!-- Modern browsers -->
138
+ <script type="importmap">
139
+ {
140
+ "imports": {
141
+ "theoplayer/chromeless": "/path/to/node_modules/theoplayer/THEOplayer.chromeless.esm.js"
142
+ }
143
+ }
144
+ </script>
145
+ <!-- Import maps polyfill for browsers without import maps support (e.g. Safari 16.3) -->
146
+ <script async src="https://ga.jspm.io/npm:es-module-shims@1.8.0/dist/es-module-shims.js" crossorigin="anonymous"></script>
147
+ <script type="module" src="/path/to/node_modules/@theoplayer/web-ui/dist/THEOplayerUI.mjs"></script>
148
+ <!-- Legacy browsers -->
125
149
  <script nomodule src="https://polyfill.io/v3/polyfill.min.js?features=es2015"></script>
126
150
  <script nomodule src="https://unpkg.com/@webcomponents/webcomponentsjs@2.8.0/custom-elements-es5-adapter.js"></script>
127
151
  <script nomodule src="https://unpkg.com/@webcomponents/webcomponentsjs@2.8.0/webcomponents-bundle.js"></script>
128
- <!-- Load modern or legacy build -->
129
- <script type="module" src="/path/to/node_modules/@theoplayer/web-ui/dist/THEOplayerUI.js"></script>
152
+ <script nomodule src="/path/to/node_modules/theoplayer/THEOplayer.chromeless.js"></script>
130
153
  <script nomodule src="/path/to/node_modules/@theoplayer/web-ui/dist/THEOplayerUI.es5.js"></script>
131
154
  ```
132
155
 
133
- - Option 2: in your JavaScript. This will load the legacy build on both modern and legacy browsers, which is suboptimal. Instead, we recommend configuring your bundler to produce a modern and legacy build of your entire web app, and to import the appropriate version of THEOplayer Web UI for each build flavor.
156
+ - Option 2: in your JavaScript. This will load the legacy build on both modern and legacy browsers, which is suboptimal. Instead, we recommend configuring your bundler to produce a modern and legacy build of your entire web app, and to import the appropriate version of Open Video UI for each build flavor.
134
157
 
135
158
  ```js
136
159
  import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js';