Skip to content

Commit

Permalink
chore(PlayerConfig): Add default value to some fields
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Dec 1, 2023
1 parent a1c3ef8 commit 923232d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/parser/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,18 @@ export function parseResponse<T extends IParsedResponse = IParsedResponse>(data:
if (data.playerConfig) {
const player_config = {
audio_config: {
loudness_db: data.playerConfig.audioConfig.loudnessDb,
perceptual_loudness_db: data.playerConfig.audioConfig.perceptualLoudnessDb,
enable_per_format_loudness: data.playerConfig.audioConfig.enablePerFormatLoudness
loudness_db: data.playerConfig.audioConfig?.loudnessDb,
perceptual_loudness_db: data.playerConfig.audioConfig?.perceptualLoudnessDb,
enable_per_format_loudness: data.playerConfig.audioConfig?.enablePerFormatLoudness
},
stream_selection_config: {
max_bitrate: data.playerConfig.streamSelectionConfig.maxBitrate
max_bitrate: data.playerConfig.streamSelectionConfig?.maxBitrate || '0'
},
media_common_config: {
dynamic_readahead_config: {
max_read_ahead_media_time_ms: data.playerConfig.mediaCommonConfig.dynamicReadaheadConfig.maxReadAheadMediaTimeMs,
min_read_ahead_media_time_ms: data.playerConfig.mediaCommonConfig.dynamicReadaheadConfig.minReadAheadMediaTimeMs,
read_ahead_growth_rate_ms: data.playerConfig.mediaCommonConfig.dynamicReadaheadConfig.readAheadGrowthRateMs
max_read_ahead_media_time_ms: data.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.maxReadAheadMediaTimeMs || 0,
min_read_ahead_media_time_ms: data.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.minReadAheadMediaTimeMs || 0,
read_ahead_growth_rate_ms: data.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.readAheadGrowthRateMs || 0
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/parser/types/ParsedResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export interface IParsedResponse {

export interface IPlayerConfig {
audio_config: {
loudness_db: number;
perceptual_loudness_db: number;
loudness_db?: number;
perceptual_loudness_db?: number;
enable_per_format_loudness: boolean;
};
stream_selection_config: {
Expand Down
4 changes: 2 additions & 2 deletions src/parser/types/RawResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ export type RawData = RawNode | RawNode[];

export interface IRawPlayerConfig {
audioConfig: {
loudnessDb: number;
perceptualLoudnessDb: number;
loudnessDb?: number;
perceptualLoudnessDb?: number;
enablePerFormatLoudness: boolean;
};
streamSelectionConfig: {
Expand Down

0 comments on commit 923232d

Please sign in to comment.