-
Notifications
You must be signed in to change notification settings - Fork 263
/
Copy pathHLSSettings.as
400 lines (362 loc) · 14.1 KB
/
HLSSettings.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mangui.hls {
import org.mangui.hls.constant.HLSSeekMode;
import org.mangui.hls.constant.HLSMaxLevelCappingMode;
public final class HLSSettings extends Object {
/**
* autoStartLoad
*
* if set to true,
* start level playlist and first fragments will be loaded automatically,
* after triggering of HlsEvent.MANIFEST_PARSED event
* if set to false,
* an explicit API call (hls.startLoad()) will be needed
* to start quality level/fragment loading.
*
* Default is true
*/
public static var autoStartLoad : Boolean = true;
/**
* capLevelToStage
*
* Limit levels usable in auto-quality by the stage dimensions (width and height).
* true - level width and height (defined in m3u8 playlist) will be compared with the player width and height (stage.stageWidth and stage.stageHeight).
* Max level will be set depending on the maxLevelCappingMode option.
* false - levels will not be limited. All available levels could be used in auto-quality mode taking only bandwidth into consideration.
*
* Note: this setting is ignored in manual mode so all the levels could be selected manually.
*
* Default is false
*/
public static var capLevelToStage : Boolean = false;
/**
* maxLevelCappingMode
*
* Defines the max level capping mode to the one available in HLSMaxLevelCappingMode
* HLSMaxLevelCappingMode.DOWNSCALE - max capped level should be the one with the dimensions equal or greater than the stage dimensions (so the video will be downscaled)
* HLSMaxLevelCappingMode.UPSCALE - max capped level should be the one with the dimensions equal or lower than the stage dimensions (so the video will be upscaled)
*
* Default is HLSMaxLevelCappingMode.DOWNSCALE
*/
public static var maxLevelCappingMode : String = HLSMaxLevelCappingMode.DOWNSCALE;
// // // // // // /////////////////////////////////
//
// org.mangui.hls.stream.HLSNetStream
//
// // // // // // /////////////////////////////////
/**
* minBufferLength
*
* Defines minimum buffer length in seconds before playback can start, after seeking or buffer stalling.
*
* Default is -1 = auto
*/
public static var minBufferLength : Number = -1;
/**
* minBufferLengthCapping
*
* Defines minimum buffer length capping value (max value) if minBufferLength is set to -1
*
* Default is -1 = no capping
*/
public static var minBufferLengthCapping : Number = -1;
/**
* maxBufferLength
*
* Defines maximum buffer length in seconds.
* (0 means infinite buffering)
*
* Default is 120
*/
public static var maxBufferLength : Number = 120;
/**
* maxBackBufferLength
*
* Defines maximum back buffer length in seconds.
* (0 means infinite back buffering)
*
* Default is 30
*/
public static var maxBackBufferLength : Number = 30;
/**
* lowBufferLength
*
* Defines low buffer length in seconds.
* When crossing down this threshold, HLS will switch to buffering state.
*
* Default is 3
*/
public static var lowBufferLength : Number = 3;
/**
* mediaTimeUpdatePeriod
*
* time update period in ms
* period at which HLSEvent.MEDIA_TIME will be triggered
* Default is 100 ms
*/
public static var mediaTimePeriod : int = 100;
/**
* fpsDroppedMonitoringPeriod
*
* dropped FPS Monitor Period in ms
* period at which nb dropped FPS will be checked
* Default is 5000 ms
*/
public static var fpsDroppedMonitoringPeriod : int = 5000;
/**
* fpsDroppedMonitoringThreshold
*
* dropped FPS Threshold
* every fpsDroppedMonitoringPeriod, dropped FPS will be compared to displayed FPS.
* if during that period, ratio of (dropped FPS/displayed FPS) is greater or equal
* than fpsDroppedMonitoringThreshold, HLSEvent.FPS_DROP event will be fired
* Default is 0.2 (20%)
*/
public static var fpsDroppedMonitoringThreshold : Number = 0.2;
/**
* capLevelonFPSDrop
*
* Limit levels usable in auto-quality when FPS drop is detected
* i.e. if frame drop is detected on level 5, auto level will be capped to level 4 a
* true - enabled
* false - disabled
*
* Note: this setting is ignored in manual mode so all the levels could be selected manually.
*
* Default is false
*/
public static var capLevelonFPSDrop : Boolean = false;
/**
* smoothAutoSwitchonFPSDrop
*
* force a smooth level switch Limit when FPS drop is detected in auto-quality
* i.e. if frame drop is detected on level 5, it will trigger an auto quality level switch
* to level 4 for next fragment
* true - enabled
* false - disabled
*
* Note: this setting is active only if capLevelonFPSDrop==true
*
* Default is true
*/
public static var smoothAutoSwitchonFPSDrop : Boolean = true;
/**
* switchDownOnLevelError
*
* if level loading fails, and if in auto mode, and we are not on lowest level
* don't report Level loading error straight-away, try to switch down first
* true - enabled
* false - disabled
*
* Default is true
*/
public static var switchDownOnLevelError : Boolean = true;
/**
* seekMode
*
* Defines seek mode to one form available in HLSSeekMode class:
* HLSSeekMode.ACCURATE_SEEK - accurate seeking to exact requested position
* HLSSeekMode.KEYFRAME_SEEK - key-frame based seeking (seek to nearest key frame before requested seek position)
*
* Default is HLSSeekMode.KEYFRAME_SEEK
*/
public static var seekMode : String = HLSSeekMode.KEYFRAME_SEEK;
/**
* keyLoadMaxRetry
*
* Max nb of retries for Key Loading in case I/O errors are met,
* 0, means no retry, error will be triggered automatically
* -1 means infinite retry
*
* Default is 3
*/
public static var keyLoadMaxRetry : int = 3;
/**
* keyLoadMaxRetryTimeout
*
* Maximum key retry timeout (in milliseconds) in case I/O errors are met.
* Every fail on key request, player will exponentially increase the timeout to try again.
* It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until keyLoadMaxRetryTimeout is reached.
*
* Default is 64000.
*/
public static var keyLoadMaxRetryTimeout : Number = 64000;
/**
* fragmentLoadMaxRetry
*
* Max number of retries for Fragment Loading in case I/O errors are met,
* 0, means no retry, error will be triggered automatically
* -1 means infinite retry
*
* Default is 3
*/
public static var fragmentLoadMaxRetry : int = 3;
/**
* fragmentLoadMaxRetryTimeout
*
* Maximum Fragment retry timeout (in milliseconds) in case I/O errors are met.
* Every fail on fragment request, player will exponentially increase the timeout to try again.
* It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until fragmentLoadMaxRetryTimeout is reached.
*
* Default is 4000
*/
public static var fragmentLoadMaxRetryTimeout : Number = 4000;
/**
* fragmentLoadSkipAfterMaxRetry
*
* control behaviour in case fragment load still fails after max retry timeout
* if set to true, fragment will be skipped and next one will be loaded.
* If set to false, an I/O Error will be raised.
*
* Default is true.
*/
public static var fragmentLoadSkipAfterMaxRetry : Boolean = true;
/**
* maxSkippedFragments
*
* Maximum count of skipped fragments in a row before an I/O Error will be raised.
* 0 - no skip (same as fragmentLoadSkipAfterMaxRetry = false)
* -1 - no limit for skipping, skip till the end of the playlist
*
* Default is 5.
*/
public static var maxSkippedFragments : int = 5;
/**
* flushLiveURLCache
*
* If set to true, live playlist will be flushed from URL cache before reloading
* (this is to workaround some cache issues with some combination of Flash Player / IE version)
*
* Default is false
*/
public static var flushLiveURLCache : Boolean = false;
/**
* initialLiveManifestSize
*
* Number of segments needed to start playback of Live stream.
*
* Default is 1
*/
public static var initialLiveManifestSize : uint = 1;
/**
* manifestLoadMaxRetry
*
* max nb of retries for Manifest Loading in case I/O errors are met,
* 0, means no retry, error will be triggered automatically
* -1 means infinite retry
*/
public static var manifestLoadMaxRetry : int = 3;
/**
* manifestLoadMaxRetryTimeout
*
* Maximum Manifest retry timeout (in milliseconds) in case I/O errors are met.
* Every fail on fragment request, player will exponentially increase the timeout to try again.
* It starts waiting 1 second (1000ms), than 2, 4, 8, 16, until manifestLoadMaxRetryTimeout is reached.
*
* Default is 64000
*/
public static var manifestLoadMaxRetryTimeout : Number = 64000;
/**
* manifestRedundantLoadmaxRetry
*
* max nb of looping over the redundant streams.
* >0 means looping over the stream array 2 or more times
* 0 means looping exactly once (no retries) - default behaviour
* -1 means infinite retry
*/
public static var manifestRedundantLoadmaxRetry : int = 3;
/**
* startFromBitrate
*
* If greater than 0, specifies the preferred bitrate.
* If -1, and startFromLevel is not specified, automatic start level selection will be used.
* This parameter, if set, will take priority over startFromLevel.
*
* Default is -1
*/
public static var startFromBitrate : Number = -1;
/**
* startFromLevel
*
* start level :
* from 0 to 1 : indicates the "normalized" preferred level. As such, if it is 0.5, the closest to the middle bitrate will be selected and used first.
* -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)
* -2 : playback will start from the first level appearing in Manifest (not sorted by bitrate)
*
* Default is -1
*/
public static var startFromLevel : Number = -1;
/**
* autoStartMaxDuration
*
* max fragment loading duration in automatic start level selection mode (in ms)
* -1 : max duration not capped
* other : max duration is capped to avoid long playback starting time
*
* Default is -1
*/
public static var autoStartMaxDuration : Number = -1;
/**
* seekFromLevel
*
* Seek level:
* from 0 to 1: indicates the "normalized" preferred bitrate. As such, if it is 0.5, the closest to the middle bitrate will be selected and used first.
* -1 : automatic start level selection, keep previous level matching previous download bandwidth
*
* Default is -1
*/
public static var seekFromLevel : Number = -1;
/**
* useHardwareVideoDecoder
*
* Use hardware video decoder:
* it will set NetStream.useHardwareDecoder
* refer to http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#useHardwareDecoder
*
* Default is true
*/
public static var useHardwareVideoDecoder : Boolean = true;
/**
* logInfo
*
* Defines whether INFO level log messages will will appear in the console
*
* Default is true
*/
public static var logInfo : Boolean = true;
/**
* logDebug
*
* Defines whether DEBUG level log messages will will appear in the console
*
* Default is false
*/
public static var logDebug : Boolean = false;
/**
* logDebug2
*
* Defines whether DEBUG2 level log messages will will appear in the console
*
* Default is false
*/
public static var logDebug2 : Boolean = false;
/**
* logWarn
*
* Defines whether WARN level log messages will will appear in the console
*
* Default is true
*/
public static var logWarn : Boolean = true;
/**
* logError
*
* Defines whether ERROR level log messages will will appear in the console
*
* Default is true
*/
public static var logError : Boolean = true;
}
}