@srgssr/pillarbox-web 1.15.0 → 1.15.2
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 +117 -0
- package/dist/pillarbox-core.cjs.js +1 -1
- package/dist/pillarbox-core.es.js +1 -1
- package/dist/pillarbox.cjs.js +16 -2
- package/dist/pillarbox.cjs.js.map +1 -1
- package/dist/pillarbox.es.js +16 -2
- package/dist/pillarbox.es.js.map +1 -1
- package/dist/pillarbox.umd.js +16 -2
- package/dist/pillarbox.umd.js.map +1 -1
- package/dist/pillarbox.umd.min.js +8 -8
- package/dist/pillarbox.umd.min.js.map +1 -1
- package/dist/types/src/trackers/PillarboxMonitoring.d.ts +10 -0
- package/dist/types/src/trackers/PillarboxMonitoring.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Pillarbox Web Player
|
|
2
|
+
|
|
3
|
+
[](https://github.com/SRGSSR/pillarbox-web)
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
The Pillarbox Web Player is a web-based video player that extends Video.js to enable playback of
|
|
8
|
+
SRGSSR content through a custom data provider. This player is designed to enhance the viewing
|
|
9
|
+
experience of SRGSSR content, making it more accessible and feature-rich.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
To get started with Pillarbox, install it through the following command:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save @srgssr/pillarbox-web
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
In your HTML file, add the following code to initialize Pillarbox:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<video-js id="my-player" class="pillarbox-js" controls></video-js>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Import the CSS file in your HTML to apply Pillarbox default theme:
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<link rel="stylesheet" href="node_modules/@srgssr/pillarbox-web/dist/pillarbox.min.css"/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Finally, import Pillarbox and set up the player:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
import Pillarbox from '@srgssr/pillarbox-web';
|
|
35
|
+
|
|
36
|
+
const player = new Pillarbox('my-player', {/* options... */ });
|
|
37
|
+
player.src({ src: 'urn:swi:video:48115940', type: 'srgssr/urn' });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
For detailed information on how to use the Pillarbox Web Player, checkout
|
|
43
|
+
the [API Documentation](https://web.pillarbox.ch/api).
|
|
44
|
+
|
|
45
|
+
A live demo of the player is available
|
|
46
|
+
here: [Pillarbox Web Demo](https://demo.pillarbox.ch).
|
|
47
|
+
|
|
48
|
+
To expand the features that Pillarbox offers out of the box, visit the [Pillarbox Web
|
|
49
|
+
Suite](https://github.com/SRGSSR/pillarbox-web-suite). You are welcome to contribute and share your
|
|
50
|
+
own components there.
|
|
51
|
+
|
|
52
|
+
You can create your own theme with
|
|
53
|
+
the [Pillarbox Theme Editor](https://editor.pillarbox.ch).
|
|
54
|
+
|
|
55
|
+
## Pillarbox flavours
|
|
56
|
+
|
|
57
|
+
Pillarbox comes in two variants:
|
|
58
|
+
|
|
59
|
+
- `pillarbox-core`: is the core library that provides a rich set of features on top of the Video.js
|
|
60
|
+
API. It does not include any SRGSSR-specific business logic, so it can be used by any developer
|
|
61
|
+
who wants to customize their own video player.
|
|
62
|
+
- `pillarbox` is the complete package that includes the core library as well as the SRGSSR data
|
|
63
|
+
provider and analytics. It is designed for SRGSSR applications that need to integrate with the
|
|
64
|
+
SRGSSR media platform and tracking behavior.
|
|
65
|
+
|
|
66
|
+
## TypeScript Support
|
|
67
|
+
|
|
68
|
+
TypeScript is a language that extends JavaScript with static types and other features. It helps to
|
|
69
|
+
write more reliable and maintainable code. `Pillarbox` is written in plain JavaScript, but it
|
|
70
|
+
provides type declarations for TypeScript users. These declarations are carefully generated and
|
|
71
|
+
included in the bundled package.
|
|
72
|
+
|
|
73
|
+
## Contributing
|
|
74
|
+
|
|
75
|
+
If you want to contribute to this project, you are welcome to do so. Please follow the code style
|
|
76
|
+
and linting rules defined in this project. You can use the following commands to check and fix your
|
|
77
|
+
code:
|
|
78
|
+
|
|
79
|
+
Check your javascript code:
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
npm run eslint
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Check your CSS and SCSS code:
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
npm run stylelint
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Fix your CSS and SCSS code:
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
npm run stylelint:fix
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This project also has a pre-commit hook that runs the linting check automatically before you commit
|
|
98
|
+
your changes. You can enable this hook by running the `prepare` script: `npm run prepare`.
|
|
99
|
+
|
|
100
|
+
Before submitting a pull request, please make sure that your code builds successfully. You can use
|
|
101
|
+
the following commands to build the project:
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
npm run build
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
If you want to enhance our demo application you can get involved
|
|
108
|
+
here: https://github.com/SRGSSR/pillarbox-web-demo
|
|
109
|
+
To contribute to the theme editor go to: https://github.com/SRGSSR/pillarbox-web-theme-editor
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
See the [LICENSE](LICENSE) file for more information.
|
|
114
|
+
|
|
115
|
+
[token-settings]: https://github.com/settings/tokens
|
|
116
|
+
|
|
117
|
+
[token-guide]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token
|
package/dist/pillarbox.cjs.js
CHANGED
|
@@ -109,7 +109,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
109
109
|
return target;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const version = "1.
|
|
112
|
+
const version = "1.15.1";
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* @ignore
|
|
@@ -1892,7 +1892,7 @@ class PillarboxMonitoring {
|
|
|
1892
1892
|
this.sendEvent('ERROR', _objectSpread2(_objectSpread2({
|
|
1893
1893
|
log: JSON.stringify(error.metadata || pillarbox.log.history().slice(-15)),
|
|
1894
1894
|
message: error.message,
|
|
1895
|
-
name: error.code
|
|
1895
|
+
name: PillarboxMonitoring.errorKeyCode(error.code)
|
|
1896
1896
|
}, playbackPosition), {}, {
|
|
1897
1897
|
url
|
|
1898
1898
|
}));
|
|
@@ -2404,6 +2404,20 @@ class PillarboxMonitoring {
|
|
|
2404
2404
|
};
|
|
2405
2405
|
}
|
|
2406
2406
|
|
|
2407
|
+
/**
|
|
2408
|
+
* Returns a string representing the error key combined with its error code.
|
|
2409
|
+
*
|
|
2410
|
+
* If the error code doesn't exist the error key undefined.
|
|
2411
|
+
*
|
|
2412
|
+
* @param {number} code The error code
|
|
2413
|
+
*
|
|
2414
|
+
* @returns {string} The error key combined with its error code
|
|
2415
|
+
*/
|
|
2416
|
+
static errorKeyCode(code) {
|
|
2417
|
+
const error = ['MEDIA_ERR_CUSTOM', ...Object.keys(window.MediaError), 'MEDIA_ERR_ENCRYPTED'];
|
|
2418
|
+
return `${error[code]}: ${code}`;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2407
2421
|
/**
|
|
2408
2422
|
* Generates a new session ID.
|
|
2409
2423
|
*
|