@mediabunny/mp3-encoder 1.29.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/mediabunny-mp3-encoder.js +7 -0
- package/dist/bundles/mediabunny-mp3-encoder.min.js +2 -1
- package/dist/bundles/mediabunny-mp3-encoder.min.mjs +2 -1
- package/dist/bundles/mediabunny-mp3-encoder.mjs +7 -0
- package/dist/modules/src/index.d.ts.map +1 -1
- package/dist/modules/src/index.js +8 -0
- package/package.json +1 -1
- package/src/index.ts +11 -0
|
@@ -272,6 +272,13 @@ function Worker2() {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
// packages/mp3-encoder/src/index.ts
|
|
275
|
+
var MP3_ENCODER_LOADED_SYMBOL = Symbol.for("@mediabunny/mp3-encoder loaded");
|
|
276
|
+
if (globalThis[MP3_ENCODER_LOADED_SYMBOL]) {
|
|
277
|
+
console.error(
|
|
278
|
+
"[WARNING]\n@mediabunny/mp3-encoder was loaded twice. This will likely cause the encoder not to work correctly. Check if multiple dependencies are importing different versions of @mediabunny/mp3-encoder, or if something is being bundled incorrectly."
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
globalThis[MP3_ENCODER_LOADED_SYMBOL] = true;
|
|
275
282
|
var Mp3Encoder = class extends CustomAudioEncoder {
|
|
276
283
|
constructor() {
|
|
277
284
|
super(...arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyMH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,YAE9B,CAAC"}
|
|
@@ -15,6 +15,14 @@ const mediabunny_1 = require("mediabunny");
|
|
|
15
15
|
const mp3_misc_1 = require("../../../shared/mp3-misc");
|
|
16
16
|
// @ts-expect-error An esbuild plugin handles this, TypeScript doesn't need to understand
|
|
17
17
|
const encode_worker_1 = __importDefault(require("./encode.worker"));
|
|
18
|
+
const MP3_ENCODER_LOADED_SYMBOL = Symbol.for('@mediabunny/mp3-encoder loaded');
|
|
19
|
+
if (globalThis[MP3_ENCODER_LOADED_SYMBOL]) {
|
|
20
|
+
console.error('[WARNING]\n@mediabunny/mp3-encoder was loaded twice.'
|
|
21
|
+
+ ' This will likely cause the encoder not to work correctly.'
|
|
22
|
+
+ ' Check if multiple dependencies are importing different versions of @mediabunny/mp3-encoder,'
|
|
23
|
+
+ ' or if something is being bundled incorrectly.');
|
|
24
|
+
}
|
|
25
|
+
globalThis[MP3_ENCODER_LOADED_SYMBOL] = true;
|
|
18
26
|
class Mp3Encoder extends mediabunny_1.CustomAudioEncoder {
|
|
19
27
|
constructor() {
|
|
20
28
|
super(...arguments);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediabunny/mp3-encoder",
|
|
3
3
|
"author": "Vanilagy",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.30.0",
|
|
5
5
|
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
|
6
6
|
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
|
7
7
|
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,17 @@ import type { WorkerCommand, WorkerResponse, WorkerResponseData } from './shared
|
|
|
12
12
|
// @ts-expect-error An esbuild plugin handles this, TypeScript doesn't need to understand
|
|
13
13
|
import createWorker from './encode.worker';
|
|
14
14
|
|
|
15
|
+
const MP3_ENCODER_LOADED_SYMBOL = Symbol.for('@mediabunny/mp3-encoder loaded');
|
|
16
|
+
if ((globalThis as Record<symbol, unknown>)[MP3_ENCODER_LOADED_SYMBOL]) {
|
|
17
|
+
console.error(
|
|
18
|
+
'[WARNING]\n@mediabunny/mp3-encoder was loaded twice.'
|
|
19
|
+
+ ' This will likely cause the encoder not to work correctly.'
|
|
20
|
+
+ ' Check if multiple dependencies are importing different versions of @mediabunny/mp3-encoder,'
|
|
21
|
+
+ ' or if something is being bundled incorrectly.',
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
(globalThis as Record<symbol, unknown>)[MP3_ENCODER_LOADED_SYMBOL] = true;
|
|
25
|
+
|
|
15
26
|
class Mp3Encoder extends CustomAudioEncoder {
|
|
16
27
|
private worker: Worker | null = null;
|
|
17
28
|
private nextMessageId = 0;
|