From d41b9ecc79423bb2543a8b739f28146793ecdfb0 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 25 Oct 2024 15:24:23 -0700 Subject: [PATCH 1/2] mimeTypeToVideoCodecString should not throw The current implementation is not resilient to codecs changes. If a new codec is introduced, previously working code would start failing. --- src/room/track/utils.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/room/track/utils.ts b/src/room/track/utils.ts index 0b62e08a1a..82e6122c05 100644 --- a/src/room/track/utils.ts +++ b/src/room/track/utils.ts @@ -9,7 +9,6 @@ import { type ScreenShareCaptureOptions, type VideoCaptureOptions, type VideoCodec, - videoCodecs, } from './options'; import type { AudioTrack } from './types'; @@ -188,11 +187,7 @@ export function screenCaptureToDisplayMediaStreamOptions( } export function mimeTypeToVideoCodecString(mimeType: string) { - const codec = mimeType.split('/')[1].toLowerCase() as VideoCodec; - if (!videoCodecs.includes(codec)) { - throw Error(`Video codec not supported: ${codec}`); - } - return codec; + return mimeType.split('/')[1].toLowerCase() as VideoCodec; } export function getTrackPublicationInfo( From aeb3d87291a6ae9654e8432cebcad788ec25ed75 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 25 Oct 2024 15:27:02 -0700 Subject: [PATCH 2/2] changeset --- .changeset/heavy-garlics-greet.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/heavy-garlics-greet.md diff --git a/.changeset/heavy-garlics-greet.md b/.changeset/heavy-garlics-greet.md new file mode 100644 index 0000000000..803544600b --- /dev/null +++ b/.changeset/heavy-garlics-greet.md @@ -0,0 +1,5 @@ +--- +'livekit-client': patch +--- + +fix: mimeTypeToVideoCodecString should not throw