mediabunny 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  <img src="./docs/public/mediabunny-logo.svg" height="180">
9
9
  </div>
10
10
 
11
- Mediabunny is a JavaScript library for reading, writing, and converting media files (like MP4 or WebM), directly in the browser. It aims to be a complete toolkit for high-performance media operations on the web. It's written from scratch in pure TypeScript, has zero dependencies, is very performant, and is extremely tree-shakable, meaning you only include what you use. You can think of it a bit like [FFmpeg](https://ffmpeg.org/), but built from the ground up for the web.
11
+ Mediabunny is a JavaScript library for reading, writing, and converting media files (like MP4, WebM, MP3), directly in the browser. It aims to be a complete toolkit for high-performance media operations on the web. It's written from scratch in pure TypeScript, has zero dependencies, is very performant, and is extremely tree-shakable, meaning you only include what you use. You can think of it a bit like [FFmpeg](https://ffmpeg.org/), but built from the ground up for the web.
12
12
 
13
13
  [Documentation](https://mediabunny.dev) | [Examples](https://mediabunny.dev/examples) | [Sponsoring](#sponsoring) | [License](#license) | [Discord](https://discord.gg/hmpkyYuS4U)
14
14
 
@@ -213,14 +213,18 @@ var Mediabunny = (() => {
213
213
  }
214
214
  };
215
215
  var toUint8Array = (source) => {
216
- if (source instanceof ArrayBuffer) {
216
+ if (source instanceof Uint8Array) {
217
+ return source;
218
+ } else if (source instanceof ArrayBuffer) {
217
219
  return new Uint8Array(source);
218
220
  } else {
219
221
  return new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
220
222
  }
221
223
  };
222
224
  var toDataView = (source) => {
223
- if (source instanceof ArrayBuffer) {
225
+ if (source instanceof DataView) {
226
+ return source;
227
+ } else if (source instanceof ArrayBuffer) {
224
228
  return new DataView(source);
225
229
  } else {
226
230
  return new DataView(source.buffer, source.byteOffset, source.byteLength);
@@ -275,7 +279,7 @@ var Mediabunny = (() => {
275
279
  return !!colorSpace && !!colorSpace.primaries && !!colorSpace.transfer && !!colorSpace.matrix && colorSpace.fullRange !== void 0;
276
280
  };
277
281
  var isAllowSharedBufferSource = (x) => {
278
- return x instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && x instanceof SharedArrayBuffer || ArrayBuffer.isView(x) && !(x instanceof DataView);
282
+ return x instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && x instanceof SharedArrayBuffer || ArrayBuffer.isView(x);
279
283
  };
280
284
  var AsyncMutex = class {
281
285
  constructor() {
@@ -7748,7 +7752,7 @@ ${cue.notes ?? ""}`;
7748
7752
  });
7749
7753
  } else {
7750
7754
  const data = new ArrayBuffer(this.allocationSize({ planeIndex: 0, format: this.format }));
7751
- this.copyTo(new DataView(data), { planeIndex: 0, format: this.format });
7755
+ this.copyTo(data, { planeIndex: 0, format: this.format });
7752
7756
  return new AudioData({
7753
7757
  format: this.format,
7754
7758
  sampleRate: this.sampleRate,
@@ -10289,7 +10293,7 @@ ${cue.notes ?? ""}`;
10289
10293
  const support = await VideoEncoder.isConfigSupported(encoderConfig);
10290
10294
  if (!support.supported) {
10291
10295
  throw new Error(
10292
- "This specific encoder configuration is not supported by this browser. Consider using another codec or changing your video parameters."
10296
+ `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.`
10293
10297
  );
10294
10298
  }
10295
10299
  this.encoder = new VideoEncoder({
@@ -10684,7 +10688,7 @@ ${cue.notes ?? ""}`;
10684
10688
  const support = await AudioEncoder.isConfigSupported(encoderConfig);
10685
10689
  if (!support.supported) {
10686
10690
  throw new Error(
10687
- "This specific encoder configuration not supported by this browser. Consider using another codec or changing your audio parameters."
10691
+ `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.`
10688
10692
  );
10689
10693
  }
10690
10694
  this.encoder = new AudioEncoder({