diff --git a/src/parser/parser.ts b/src/parser/parser.ts index e487c5d5b..84f13415b 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -401,18 +401,18 @@ export function parseResponse(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 } } }; diff --git a/src/parser/types/ParsedResponse.ts b/src/parser/types/ParsedResponse.ts index 1659633cd..1fcde9969 100644 --- a/src/parser/types/ParsedResponse.ts +++ b/src/parser/types/ParsedResponse.ts @@ -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: { diff --git a/src/parser/types/RawResponse.ts b/src/parser/types/RawResponse.ts index 5577393b0..6dac01a00 100644 --- a/src/parser/types/RawResponse.ts +++ b/src/parser/types/RawResponse.ts @@ -3,8 +3,8 @@ export type RawData = RawNode | RawNode[]; export interface IRawPlayerConfig { audioConfig: { - loudnessDb: number; - perceptualLoudnessDb: number; + loudnessDb?: number; + perceptualLoudnessDb?: number; enablePerFormatLoudness: boolean; }; streamSelectionConfig: {