-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfiguration-defaults.ts
More file actions
51 lines (45 loc) · 1.73 KB
/
configuration-defaults.ts
File metadata and controls
51 lines (45 loc) · 1.73 KB
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
import type {
NetworkConfiguration,
PlayerConfiguration,
PlayerEmeConfiguration,
PlayerHlsConfiguration,
PlayerMseConfiguration,
PlayerNetworkConfiguration,
} from '../types/configuration.declarations';
import { RequestType } from '../consts/request-type';
export const getNetworkConfigurationDefaults = (): NetworkConfiguration => ({
maxAttempts: 2,
initialDelay: 2_000,
delayFactor: 0.2,
fuzzFactor: 0.2,
timeout: 20_000,
});
export const getPlayerNetworkConfigurationDefaults = (): PlayerNetworkConfiguration => ({
[RequestType.DashManifest]: getNetworkConfigurationDefaults(),
[RequestType.HlsPlaylist]: getNetworkConfigurationDefaults(),
[RequestType.License]: getNetworkConfigurationDefaults(),
[RequestType.Key]: getNetworkConfigurationDefaults(),
[RequestType.InitSegment]: getNetworkConfigurationDefaults(),
[RequestType.MediaSegment]: getNetworkConfigurationDefaults(),
});
export const getPlayerEmeConfigurationDefaults = (): PlayerEmeConfiguration => ({
reusePersistentKeySessions: false,
audioRobustness: '',
videoRobustness: '',
});
export const getPlayerMseConfigurationDefaults = (): PlayerMseConfiguration => ({
useManagedMediaSourceIfAvailable: true,
requiredBufferDuration: 30,
});
export const getPlayerHlsConfigurationDefaults = (): PlayerHlsConfiguration => ({
ignoreTags: new Set(),
customTagMap: new Map(),
transformTagValue: (tagKey, tagValue) => tagValue,
transformTagAttributes: (tagKey, tagAttributes) => tagAttributes,
});
export const getPlayerConfigurationDefaults = (): PlayerConfiguration => ({
network: getPlayerNetworkConfigurationDefaults(),
mse: getPlayerMseConfigurationDefaults(),
hls: getPlayerHlsConfigurationDefaults(),
eme: getPlayerEmeConfigurationDefaults(),
});