From 0ace1107c6b14eef3c731b0011629093766e6939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvin=20Hedenstr=C3=B6m?= Date: Thu, 4 Jul 2024 09:28:27 +0200 Subject: [PATCH] Changed method of checking array Instead of converting it, we now just check if it's an array and then uses .includes() --- src/manifests/utils/configs.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/manifests/utils/configs.ts b/src/manifests/utils/configs.ts index 256eadb..fd0dd9d 100644 --- a/src/manifests/utils/configs.ts +++ b/src/manifests/utils/configs.ts @@ -179,12 +179,19 @@ export const corruptorConfigUtils = function ( } // If bitrate is set, filter out segments that doesn't match - params = params.filter( - (config) => + params = params.filter((config) => { + if ( !config?.br || config?.br === '*' || - config?.br.toString().includes(segmentBitrate.toString()) //Checks if .br contains bitrates that need to be filtered - ); + config?.br === segmentBitrate + ) { + return true; + } else if (Array.isArray(config?.br)) { + return config?.br.includes(segmentBitrate); + } else { + return false; + } + }); // Replace relative sequence numbers with absolute ones params = params.map((param) => {