From 1d8678ba3032318c75d2025ac85394af0167581e Mon Sep 17 00:00:00 2001 From: fireattack Date: Thu, 18 Jul 2024 14:01:45 +0800 Subject: [PATCH] Only warn once per m3u8 --- src/core/m3u8.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/m3u8.ts b/src/core/m3u8.ts index 0520bd4..191200b 100644 --- a/src/core/m3u8.ts +++ b/src/core/m3u8.ts @@ -161,7 +161,8 @@ export class Playlist { private parse() { let key: string, iv: string, - isEncrypted = false; + isEncrypted = false, + warned = false; const lines = this.m3u8Content.split("\n"); for (let i = 0; i <= lines.length - 1; i++) { /** @@ -195,9 +196,12 @@ export class Playlist { isEncrypted = false; } else { isEncrypted = false; - logger.warning( - `Unsupported encryption method: "${parsedTagBody["METHOD"]}". Chunks will not be decrypted.` - ); + if (!warned) { + logger.warning( + `Unsupported encryption method: "${parsedTagBody["METHOD"]}". Chunks will not be decrypted.` + ); + warned = true; + } } } if (currentLine.startsWith("#EXT-X-MAP")) {