@theoplayer/web-ui 1.0.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/LICENSE.md +21 -0
- package/README.md +111 -0
- package/dist/THEOplayerUI.d.ts +1752 -0
- package/dist/THEOplayerUI.js +5 -0
- package/dist/THEOplayerUI.js.map +1 -0
- package/dist/THEOplayerUI.mjs +2 -0
- package/dist/THEOplayerUI.mjs.map +1 -0
- package/package.json +70 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 THEO Technologies
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# THEOplayer Web UI
|
|
2
|
+
|
|
3
|
+
A component library for building a world-class video player experience powered by
|
|
4
|
+
the [THEOplayer Web SDK](https://www.theoplayer.com/product/theoplayer).
|
|
5
|
+
|
|
6
|
+
- Use the default UI for a great out-of-the-box experience, or use the individual components to build your own custom UI.
|
|
7
|
+
- Built using [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components), so works great with (or without) any app framework.
|
|
8
|
+
- Easy to customize: use HTML to lay out your controls, and CSS to style them.
|
|
9
|
+
|
|
10
|
+
> **Note**
|
|
11
|
+
> This project is under active development. While we believe it's ready for use in production, not all features are available in this first release. If you find a problem or have an idea for a new feature, don't hesitate to [open an issue](https://github.com/THEOplayer/web-ui/issues)!
|
|
12
|
+
|
|
13
|
+
|  |  |
|
|
14
|
+
| :------------------------------------------------------------: | :----------------------------------------------------------: |
|
|
15
|
+
| Desktop | Mobile |
|
|
16
|
+
|
|
17
|
+
## Motivation
|
|
18
|
+
|
|
19
|
+
The current THEOplayer Web SDK comes with a built-in UI based on [video.js](https://github.com/videojs/video.js) through [the `Player` constructor](https://docs.theoplayer.com/api-reference/web/theoplayer.player.md). This new UI aims to solve some limitations from the old approach:
|
|
20
|
+
|
|
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
|
+
- 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.
|
|
24
|
+
|
|
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.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
This project requires the THEOplayer Web SDK to be installed.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npm install theoplayer @theoplayer/web-ui
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can also install a different variant of the THEOplayer npm package if you don't need all features, as long as it's aliased as `theoplayer`.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm install theoplayer@npm:@theoplayer/basic-hls
|
|
40
|
+
npm install @theoplayer/web-ui
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then add `@theoplayer/web-ui` to your app:
|
|
44
|
+
|
|
45
|
+
- Option 1: in your HTML.
|
|
46
|
+
```html
|
|
47
|
+
<script src="/path/to/node_modules/@theoplayer/web-ui/dist/THEOplayerUI.js"></script>
|
|
48
|
+
```
|
|
49
|
+
- Option 2: in your JavaScript.
|
|
50
|
+
```js
|
|
51
|
+
import * as THEOplayerUI from '@theoplayer/web-ui';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **Warning**
|
|
55
|
+
> 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.
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### Default UI
|
|
60
|
+
|
|
61
|
+
`<theoplayer-default-ui>` provides a fully-featured video player experience with minimal setup, and allows for small customizations such as changing colors or fonts.
|
|
62
|
+
|
|
63
|
+
- Option 1: in your HTML.
|
|
64
|
+
```html
|
|
65
|
+
<theoplayer-default-ui
|
|
66
|
+
configuration='{"libraryLocation":"/path/to/node_modules/theoplayer/","license":"your_theoplayer_license_goes_here"}'
|
|
67
|
+
source='{"sources":{"src":"https://example.com/stream.m3u8"}}'
|
|
68
|
+
></theoplayer-default-ui>
|
|
69
|
+
```
|
|
70
|
+
- Option 2: in your JavaScript.
|
|
71
|
+
```js
|
|
72
|
+
import { DefaultUI } from '@theoplayer/web-ui';
|
|
73
|
+
const ui = new DefaultUI({
|
|
74
|
+
configuration: {
|
|
75
|
+
libraryLocation: '/path/to/node_modules/theoplayer/',
|
|
76
|
+
license: 'your_theoplayer_license_goes_here'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
ui.source = {
|
|
80
|
+
sources: {
|
|
81
|
+
src: 'https://example.com/stream.m3u8'
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
See [docs/examples/default-ui.html](https://github.com/THEOplayer/web-ui/blob/main/docs/examples/default-ui.html) for a complete
|
|
87
|
+
example.
|
|
88
|
+
|
|
89
|
+
### Custom UI
|
|
90
|
+
|
|
91
|
+
If you want to fully customize your video player layout, you can use a `<theoplayer-ui>` instead.
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<theoplayer-ui
|
|
95
|
+
configuration='{"libraryLocation":"/path/to/node_modules/theoplayer/","license":"your_theoplayer_license_goes_here"}'
|
|
96
|
+
source='{"sources":{"src":"https://example.com/stream.m3u8"}}'
|
|
97
|
+
>
|
|
98
|
+
<!-- Choose your own layout using the provided components (or your own!) -->
|
|
99
|
+
<theoplayer-control-bar>
|
|
100
|
+
<theoplayer-time-range></theoplayer-time-range>
|
|
101
|
+
</theoplayer-control-bar>
|
|
102
|
+
<theoplayer-control-bar>
|
|
103
|
+
<theoplayer-play-button></theoplayer-play-button>
|
|
104
|
+
<theoplayer-mute-button></theoplayer-mute-button>
|
|
105
|
+
<theoplayer-volume-range></theoplayer-volume-range>
|
|
106
|
+
</theoplayer-control-bar>
|
|
107
|
+
</theoplayer-ui>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
See [docs/examples/custom-ui.html](https://github.com/THEOplayer/web-ui/blob/main/docs/examples/custom-ui.html) for a complete
|
|
111
|
+
example.
|