From 1b382d3e5759501dbe89e50fc390bb17b3c2d1dc Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Mon, 7 Jul 2025 11:21:42 +0200 Subject: [PATCH] Improve unsupported encoder configuration error messages --- dev/convert.html | 5 +++-- package-lock.json | 4 ++-- package.json | 2 +- src/media-source.ts | 10 ++++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dev/convert.html b/dev/convert.html index 00322c1..3fcaad9 100644 --- a/dev/convert.html +++ b/dev/convert.html @@ -21,7 +21,7 @@ chunked: true, chunkSize: 2**20 }); - const outputFormat = new Mediabunny.MovOutputFormat(); + const outputFormat = new Mediabunny.Mp4OutputFormat(); const button = document.createElement('button'); button.textContent = 'Cancel'; @@ -38,7 +38,8 @@ target }), audio: { - codec: 'pcm-f64' + codec: 'opus', + bitrate: 128000, //numberOfChannels: 1, //sampleRate: 4000 //discard: true diff --git a/package-lock.json b/package-lock.json index becac23..c857052 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mediabunny", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mediabunny", - "version": "1.0.1", + "version": "1.0.2", "license": "MPL-2.0", "dependencies": { "@types/dom-mediacapture-transform": "^0.1.11", diff --git a/package.json b/package.json index 9a6e1b5..23425fc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mediabunny", "author": "Vanilagy", - "version": "1.0.1", + "version": "1.0.2", "description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.", "type": "module", "main": "./dist/mediabunny.js", diff --git a/src/media-source.ts b/src/media-source.ts index 7734f5f..d6ad97e 100644 --- a/src/media-source.ts +++ b/src/media-source.ts @@ -416,8 +416,9 @@ class VideoEncoderWrapper { const support = await VideoEncoder.isConfigSupported(encoderConfig); if (!support.supported) { throw new Error( - 'This specific encoder configuration is not supported by this browser. Consider using another' - + ' codec or changing your video parameters.', + `This specific encoder configuration (${encoderConfig.codec}, ${encoderConfig.bitrate} bps,` + + ` ${encoderConfig.width}x${encoderConfig.height}) is not supported by this browser. Consider` + + ` using another codec or changing your video parameters.`, ); } @@ -988,8 +989,9 @@ class AudioEncoderWrapper { const support = await AudioEncoder.isConfigSupported(encoderConfig); if (!support.supported) { throw new Error( - 'This specific encoder configuration not supported by this browser. Consider using another' - + ' codec or changing your audio parameters.', + `This specific encoder configuration (${encoderConfig.codec}, ${encoderConfig.bitrate} bps,` + + ` ${encoderConfig.numberOfChannels} channels, ${encoderConfig.sampleRate} Hz) is not` + + ` supported by this browser. Consider using another codec or changing your audio parameters.`, ); }