@clappr/hlsjs-playback 3.0.3 → 3.1.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
@@ -27,11 +27,11 @@ or as an npm package:
27
27
 
28
28
  ### Which artifact to load
29
29
 
30
- | Scenario | Artifact |
31
- |---|---|
32
- | `<script>` / CDN, after `@clappr/core` and `hls.js` | `dist/hlsjs-playback.min.js` |
33
- | Bundler, CommonJS / UMD entry | `dist/hlsjs-playback.js` (package `main`) |
34
- | Bundler, ESM entry | `dist/hlsjs-playback.esm.js` (package `module`) |
30
+ | Scenario | Artifact |
31
+ | --------------------------------------------------- | ----------------------------------------------- |
32
+ | `<script>` / CDN, after `@clappr/core` and `hls.js` | `dist/hlsjs-playback.min.js` |
33
+ | Bundler, CommonJS / UMD entry | `dist/hlsjs-playback.js` (package `main`) |
34
+ | Bundler, ESM entry | `dist/hlsjs-playback.esm.js` (package `module`) |
35
35
 
36
36
  **Migration note (3.0+):** Every artifact now expects `hls.js` from the page or bundler. If you loaded `hlsjs-playback.min.js` with a single script tag, add `hls.js` before it. If you aliased the deep path to avoid the bundled copy, remove that entry from your bundler's `resolve.alias` (webpack) or equivalent (Vite `resolve.alias`, Rollup `alias`) — the default entry is external now:
37
37
 
@@ -42,11 +42,10 @@ or as an npm package:
42
42
  Then just add `HlsjsPlayback` into the list of plugins of your player instance:
43
43
 
44
44
  ```javascript
45
- var player = new Clappr.Player(
46
- {
47
- source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
48
- plugins: [HlsjsPlayback],
49
- });
45
+ var player = new Clappr.Player({
46
+ source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
47
+ plugins: [HlsjsPlayback]
48
+ })
50
49
  ```
51
50
 
52
51
  ## Configuration
@@ -54,38 +53,40 @@ var player = new Clappr.Player(
54
53
  The options for this playback are shown below:
55
54
 
56
55
  ```javascript
57
- var player = new Clappr.Player(
58
- {
59
- source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
60
- plugins: [HlsjsPlayback],
61
- hlsUseNextLevel: false,
62
- hlsMinimumDvrSize: 60,
63
- hlsRecoverAttempts: 16,
64
- hlsPlayback: {
65
- preload: true,
66
- customListeners: [],
67
- },
68
- playback: {
69
- extrapolatedWindowNumSegments: 2,
70
- triggerFatalErrorOnResourceDenied: false,
71
- hlsjsConfig: {
72
- // hls.js specific options
73
- },
74
- },
75
- });
56
+ var player = new Clappr.Player({
57
+ source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
58
+ plugins: [HlsjsPlayback],
59
+ hlsUseNextLevel: false,
60
+ hlsMinimumDvrSize: 60,
61
+ hlsRecoverAttempts: 16,
62
+ hlsPlayback: {
63
+ preload: true,
64
+ customListeners: []
65
+ },
66
+ playback: {
67
+ extrapolatedWindowNumSegments: 2,
68
+ triggerFatalErrorOnResourceDenied: false,
69
+ hlsjsConfig: {
70
+ // hls.js specific options
71
+ }
72
+ }
73
+ })
76
74
  ```
77
75
 
78
76
  #### hlsUseNextLevel
77
+
79
78
  > Default value: `false`
80
79
 
81
80
  The default behavior for the HLS playback is to use [hls.currentLevel](https://github.com/video-dev/hls.js/blob/master/docs/API.md#hlscurrentlevel) to switch current level. To change this behaviour and force HLS playback to use [hls.nextLevel](https://github.com/video-dev/hls.js/blob/master/docs/API.md#hlsnextlevel), add `hlsUseNextLevel: true` to embed parameters.
82
81
 
83
82
  #### hlsMinimumDvrSize
83
+
84
84
  > Default value: `60 (seconds)`
85
85
 
86
86
  Option to define the minimum DVR size to active seek on Clappr live mode.
87
87
 
88
88
  #### extrapolatedWindowNumSegments
89
+
89
90
  > Default value: `2`
90
91
 
91
92
  Configure the size of the start time extrapolation window measured as a multiple of segments.
@@ -95,17 +96,20 @@ Should be 2 or higher, or 0 to disable. It should only need to be increased abov
95
96
  E.g.: If the playlist is cached for 10 seconds and new chunks are added/removed every 5.
96
97
 
97
98
  #### hlsRecoverAttempts
99
+
98
100
  > Default value: `16`
99
101
 
100
102
  The `hls.js` have recover approaches for some fatal errors. This option sets the max recovery attempts number for those errors.
101
103
 
102
104
  #### triggerFatalErrorOnResourceDenied
105
+
103
106
  > Default value: `false`
104
107
 
105
108
  If this option is set to true, the playback will triggers fatal error event if decrypt key http response code is greater than or equal to 400. This option is used to attempt to reproduce iOS devices behaviour which internally use html5 video playback.
106
109
 
107
110
  #### hlsPlayback
108
- > Soon (in a new breaking change version), all options related to this playback that are declared in the scope of the `options` object will have to be declared necessarily within this new scope!
111
+
112
+ > Soon (in a new breaking change version), all options related to this playback that are declared in the scope of the `options` object will have to be declared necessarily within this new scope!
109
113
 
110
114
  Groups all options related directly to `HlsjsPlayback` configs.
111
115
 
@@ -121,6 +125,7 @@ var player = new Clappr.Player(
121
125
  ```
122
126
 
123
127
  #### `hlsPlayback.preload`
128
+
124
129
  > Default value: `true`
125
130
 
126
131
  Configures whether the source should be loaded as soon as the `HLS.JS` internal reference is setup or only after the first play.
@@ -145,9 +150,9 @@ var player = new Clappr.Player(
145
150
 
146
151
  The listener object parameters are:
147
152
 
148
- * `eventName`: A valid event name of `hls.js` [events API](https://github.com/video-dev/hls.js/blob/master/docs/API.md#runtime-events);
149
- * `callback`: The callback that should be called when the event listened happen.
150
- * `once`: Flag to configure if the listener needs to be valid just for one time.
153
+ - `eventName`: A valid event name of `hls.js` [events API](https://github.com/video-dev/hls.js/blob/master/docs/API.md#runtime-events);
154
+ - `callback`: The callback that should be called when the event listened happen.
155
+ - `once`: Flag to configure if the listener needs to be valid just for one time.
151
156
 
152
157
  #### hlsjsConfig
153
158
 
@@ -177,11 +182,11 @@ Enter the project directory and install the dependencies:
177
182
 
178
183
  `yarn install`
179
184
 
180
- Make your changes and run the tests:
185
+ Make your changes and run the tests (Vitest):
181
186
 
182
187
  `yarn test`
183
188
 
184
- Build your own version:
189
+ Build your own version (Vite library mode):
185
190
 
186
191
  `yarn build`
187
192
 
@@ -191,7 +196,7 @@ Starting a local server:
191
196
 
192
197
  `yarn start`
193
198
 
194
- This command will start an HTTP Server on port 8080. You can check a sample page with Clappr-core using the HlsjsPlayback on http://localhost:8080/
199
+ This command will start a Vite dev server on port 8080. You can check a sample page with Clappr-core using the HlsjsPlayback on http://localhost:8080/
195
200
 
196
201
  ## Release
197
202