From 98962984c6930da0b3e78831e8dfa8cd609a3463 Mon Sep 17 00:00:00 2001 From: Michael Hollister Date: Wed, 19 Feb 2025 01:47:36 -0600 Subject: [PATCH] Removed non-existant class in webOS 6.0/5.0 NodeJS runtime --- receivers/common/web/FCastSession.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/receivers/common/web/FCastSession.ts b/receivers/common/web/FCastSession.ts index 8e67e09..4c1080c 100644 --- a/receivers/common/web/FCastSession.ts +++ b/receivers/common/web/FCastSession.ts @@ -36,16 +36,17 @@ export class FCastSession { let data: Uint8Array; if (json) { - const utf8Encode = new TextEncoder(); - data = utf8Encode.encode(json); + // Do NOT use the TextEncoder utility class, it does not exist in the NodeJS runtime + // for webOS 6.0 and earlier... + data = Buffer.from(json, 'utf8'); } else { - data = new Uint8Array(0); + data = Buffer.alloc(0); } const size = 1 + data.length; const header = Buffer.alloc(4 + 1); - // Web OS 22 and earlier node versions do not support `writeUint32LE`, + // webOS 22 and earlier node versions do not support `writeUint32LE`, // so manually checking endianness and writing as LE // @ts-ignore if (TARGET === 'webOS') {