mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 05:43:50 +02:00
Add double loading detection and warning, improve UrlSource abort signal documentation, bump minor
This commit is contained in:
Generated
+6
-6
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"version": "1.29.1",
|
"version": "1.30.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"version": "1.29.1",
|
"version": "1.30.0",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
@@ -7739,9 +7739,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mediabunny": {
|
"node_modules/mediabunny": {
|
||||||
"version": "1.29.0",
|
"version": "1.29.1",
|
||||||
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.29.1.tgz",
|
||||||
"integrity": "sha512-18B8w/rhO/ph/AFsIXvzZg8RaSQZ+ZYfJ99MZlTjDmlgCT58jV3azrnWQ/OSquYDi8q0xmn64mnfTEHgww3+zw==",
|
"integrity": "sha512-RrlKs69MxRGa/l9cMGeI4hzuTSgchOGFHk9lIAuu9EcbSdJ05gDbRsTY67dojAiyUP3ic4PExij5OqDxqSv82Q==",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
@@ -12065,7 +12065,7 @@
|
|||||||
},
|
},
|
||||||
"packages/mp3-encoder": {
|
"packages/mp3-encoder": {
|
||||||
"name": "@mediabunny/mp3-encoder",
|
"name": "@mediabunny/mp3-encoder",
|
||||||
"version": "1.29.1",
|
"version": "1.30.0",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/emscripten": "^1.40.1"
|
"@types/emscripten": "^1.40.1"
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"author": "Vanilagy",
|
"author": "Vanilagy",
|
||||||
"version": "1.29.1",
|
"version": "1.30.0",
|
||||||
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@mediabunny/mp3-encoder",
|
"name": "@mediabunny/mp3-encoder",
|
||||||
"author": "Vanilagy",
|
"author": "Vanilagy",
|
||||||
"version": "1.29.1",
|
"version": "1.30.0",
|
||||||
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
||||||
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||||
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||||
|
|||||||
@@ -12,6 +12,17 @@ import type { WorkerCommand, WorkerResponse, WorkerResponseData } from './shared
|
|||||||
// @ts-expect-error An esbuild plugin handles this, TypeScript doesn't need to understand
|
// @ts-expect-error An esbuild plugin handles this, TypeScript doesn't need to understand
|
||||||
import createWorker from './encode.worker';
|
import createWorker from './encode.worker';
|
||||||
|
|
||||||
|
const MP3_ENCODER_LOADED_SYMBOL = Symbol.for('@mediabunny/mp3-encoder loaded');
|
||||||
|
if ((globalThis as Record<symbol, unknown>)[MP3_ENCODER_LOADED_SYMBOL]) {
|
||||||
|
console.error(
|
||||||
|
'[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.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
(globalThis as Record<symbol, unknown>)[MP3_ENCODER_LOADED_SYMBOL] = true;
|
||||||
|
|
||||||
class Mp3Encoder extends CustomAudioEncoder {
|
class Mp3Encoder extends CustomAudioEncoder {
|
||||||
private worker: Worker | null = null;
|
private worker: Worker | null = null;
|
||||||
private nextMessageId = 0;
|
private nextMessageId = 0;
|
||||||
|
|||||||
@@ -9,6 +9,17 @@
|
|||||||
/// <reference types="dom-mediacapture-transform" preserve="true" />
|
/// <reference types="dom-mediacapture-transform" preserve="true" />
|
||||||
/// <reference types="dom-webcodecs" preserve="true" />
|
/// <reference types="dom-webcodecs" preserve="true" />
|
||||||
|
|
||||||
|
const MEDIABUNNY_LOADED_SYMBOL = Symbol.for('mediabunny loaded');
|
||||||
|
if ((globalThis as Record<symbol, unknown>)[MEDIABUNNY_LOADED_SYMBOL]) {
|
||||||
|
console.error(
|
||||||
|
'[WARNING]\nMediabunny was loaded twice.'
|
||||||
|
+ ' This will likely cause Mediabunny not to work correctly.'
|
||||||
|
+ ' Check if multiple dependencies are importing different versions of Mediabunny,'
|
||||||
|
+ ' or if something is being bundled incorrectly.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
(globalThis as Record<symbol, unknown>)[MEDIABUNNY_LOADED_SYMBOL] = true;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Output,
|
Output,
|
||||||
OutputOptions,
|
OutputOptions,
|
||||||
|
|||||||
+9
-1
@@ -324,6 +324,9 @@ export type UrlSourceOptions = {
|
|||||||
/**
|
/**
|
||||||
* The [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit) used by the Fetch API. Can be
|
* The [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit) used by the Fetch API. Can be
|
||||||
* used to further control the requests, such as setting custom headers.
|
* used to further control the requests, such as setting custom headers.
|
||||||
|
*
|
||||||
|
* All fields will work except for `signal` and `headers.Range`; these will be overridden by Mediabunny. If you want
|
||||||
|
* to cancel ongoing requests, use {@link Input.dispose}.
|
||||||
*/
|
*/
|
||||||
requestInit?: RequestInit;
|
requestInit?: RequestInit;
|
||||||
|
|
||||||
@@ -368,7 +371,12 @@ export class UrlSource extends Source {
|
|||||||
abortController: AbortController;
|
abortController: AbortController;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
/** Creates a new {@link UrlSource} backed by the resource at the specified URL. */
|
/**
|
||||||
|
* Creates a new {@link UrlSource} backed by the resource at the specified URL.
|
||||||
|
*
|
||||||
|
* When passing a `Request` instance, note that the `signal` and `headers.Range` options will be overridden by
|
||||||
|
* Mediabunny. If you want to cancel ongoing requests, use {@link Input.dispose}.
|
||||||
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
url: string | URL | Request,
|
url: string | URL | Request,
|
||||||
options: UrlSourceOptions = {},
|
options: UrlSourceOptions = {},
|
||||||
|
|||||||
Reference in New Issue
Block a user