@clappr/hlsjs-playback 0.5.3 → 1.0.1

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
@@ -44,6 +44,10 @@ var player = new Clappr.Player(
44
44
  hlsUseNextLevel: false,
45
45
  hlsMinimumDvrSize: 60,
46
46
  hlsRecoverAttempts: 16,
47
+ hlsPlayback: {
48
+ preload: true,
49
+ customListeners: [],
50
+ },
47
51
  playback: {
48
52
  extrapolatedWindowNumSegments: 2,
49
53
  triggerFatalErrorOnResourceDenied: false,
@@ -83,6 +87,51 @@ The `hls.js` have recover approaches for some fatal errors. This option sets the
83
87
 
84
88
  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.
85
89
 
90
+ #### hlsPlayback
91
+ > 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!
92
+
93
+ Groups all options related directly to `HlsjsPlayback` configs.
94
+
95
+ ```javascript
96
+ var player = new Clappr.Player(
97
+ {
98
+ ...
99
+ hlsPlayback: {
100
+ preload: true,
101
+ customListeners: [],
102
+ },
103
+ });
104
+ ```
105
+
106
+ #### `hlsPlayback.preload`
107
+ > Default value: `true`
108
+
109
+ Configures whether the source should be loaded as soon as the `HLS.JS` internal reference is setup or only after the first play.
110
+
111
+ #### `hlsPlayback.customListeners`
112
+
113
+ An array of listeners object with specific parameters to add on `HLS.JS` instance.
114
+
115
+ ```javascript
116
+ var player = new Clappr.Player(
117
+ {
118
+ ...
119
+ hlsPlayback: {
120
+ ...
121
+ customListeners: [
122
+ // "hlsFragLoaded" is the value of HlsjsPlayback.HLSJS.Events.FRAG_LOADED constant.
123
+ { eventName: 'hlsFragLoaded', callback: (event, data) => { console.log('>>>>>> data: ', data) }, once: true }
124
+ ],
125
+ },
126
+ });
127
+ ```
128
+
129
+ The listener object parameters are:
130
+
131
+ * `eventName`: A valid event name of `hls.js` [events API](https://github.com/video-dev/hls.js/blob/master/docs/API.md#runtime-events);
132
+ * `callback`: The callback that should be called when the event listened happen.
133
+ * `once`: Flag to configure if the listener needs to be valid just for one time.
134
+
86
135
  #### hlsjsConfig
87
136
 
88
137
  As `HlsjsPlayback` is based on `hls.js`, it's possible to use the available `hls.js` configs too. You can check them out [here](https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning).