@remotion/webcodecs 4.0.228 → 4.0.230

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.
Files changed (62) hide show
  1. package/dist/arraybuffer-to-uint8-array.d.ts +1 -0
  2. package/dist/arraybuffer-to-uint8-array.js +7 -0
  3. package/dist/audio-decoder-config.js +3 -0
  4. package/dist/audio-decoder.d.ts +2 -2
  5. package/dist/audio-encoder-config.js +15 -2
  6. package/dist/audio-encoder.d.ts +2 -1
  7. package/dist/audio-encoder.js +16 -4
  8. package/dist/calculate-progress.d.ts +2 -2
  9. package/dist/calculate-progress.js +3 -3
  10. package/dist/can-copy-audio-track.d.ts +6 -0
  11. package/dist/can-copy-audio-track.js +13 -0
  12. package/dist/can-copy-video-track.d.ts +6 -0
  13. package/dist/can-copy-video-track.js +13 -0
  14. package/dist/can-reencode-audio-track.d.ts +7 -0
  15. package/dist/can-reencode-audio-track.js +16 -0
  16. package/dist/can-reencode-video-track.d.ts +6 -0
  17. package/dist/can-reencode-video-track.js +16 -0
  18. package/dist/choose-correct-avc1-profile.d.ts +5 -0
  19. package/dist/choose-correct-avc1-profile.js +54 -0
  20. package/dist/codec-id.d.ts +10 -2
  21. package/dist/codec-id.js +30 -0
  22. package/dist/convert-encoded-chunk.d.ts +3 -0
  23. package/dist/convert-encoded-chunk.js +38 -0
  24. package/dist/convert-media.d.ts +22 -14
  25. package/dist/convert-media.js +25 -20
  26. package/dist/default-on-audio-track-handler.d.ts +2 -0
  27. package/dist/default-on-audio-track-handler.js +36 -0
  28. package/dist/default-on-video-track-handler.d.ts +2 -0
  29. package/dist/default-on-video-track-handler.js +29 -0
  30. package/dist/esm/index.mjs +497 -210
  31. package/dist/get-default-audio-codec.d.ts +4 -0
  32. package/dist/get-default-audio-codec.js +13 -0
  33. package/dist/get-default-video-codec.d.ts +4 -0
  34. package/dist/get-default-video-codec.js +10 -0
  35. package/dist/index.d.ts +12 -1
  36. package/dist/index.js +21 -1
  37. package/dist/io-manager/io-synchronizer.js +2 -2
  38. package/dist/on-audio-track-handler.d.ts +19 -0
  39. package/dist/on-audio-track-handler.js +2 -0
  40. package/dist/on-audio-track.d.ts +6 -6
  41. package/dist/on-audio-track.js +54 -27
  42. package/dist/on-frame.d.ts +11 -0
  43. package/dist/on-frame.js +32 -0
  44. package/dist/on-video-track-handler.d.ts +18 -0
  45. package/dist/on-video-track-handler.js +2 -0
  46. package/dist/on-video-track.d.ts +10 -9
  47. package/dist/on-video-track.js +55 -25
  48. package/dist/video-decoder.d.ts +2 -2
  49. package/dist/video-decoder.js +5 -0
  50. package/dist/video-encoder-config.d.ts +7 -1
  51. package/dist/video-encoder-config.js +11 -1
  52. package/dist/video-encoder.d.ts +2 -2
  53. package/dist/video-encoder.js +4 -6
  54. package/package.json +4 -4
  55. package/dist/event-emitter.d.ts +0 -25
  56. package/dist/event-emitter.js +0 -23
  57. package/dist/resolve-audio-action.d.ts +0 -15
  58. package/dist/resolve-audio-action.js +0 -30
  59. package/dist/resolve-video-action.d.ts +0 -15
  60. package/dist/resolve-video-action.js +0 -33
  61. package/dist/wait-until-return.d.ts +0 -4
  62. package/dist/wait-until-return.js +0 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/webcodecs",
3
- "version": "4.0.228",
3
+ "version": "4.0.230",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
@@ -15,15 +15,15 @@
15
15
  "dist"
16
16
  ],
17
17
  "author": "Jonny Burger <jonny@remotion.dev>",
18
- "license": "SEE LICENSE IN LICENSE.md",
18
+ "license": "Remotion License (See https://remotion.dev/docs/webcodecs#license)",
19
19
  "dependencies": {
20
- "@remotion/media-parser": "4.0.228"
20
+ "@remotion/media-parser": "4.0.230"
21
21
  },
22
22
  "peerDependencies": {},
23
23
  "devDependencies": {
24
24
  "@types/dom-webcodecs": "0.1.11",
25
25
  "eslint": "9.14.0",
26
- "@remotion/eslint-config-internal": "4.0.228"
26
+ "@remotion/eslint-config-internal": "4.0.230"
27
27
  },
28
28
  "keywords": [],
29
29
  "publishConfig": {
@@ -1,25 +0,0 @@
1
- type Input = {
2
- timestamp: number;
3
- keyframe: boolean;
4
- };
5
- type Output = {
6
- timestamp: number;
7
- };
8
- type IoEventMap = {
9
- input: Input;
10
- output: Output;
11
- };
12
- export type IoEventTypes = keyof IoEventMap;
13
- export type CallbackListener<T extends IoEventTypes> = (data: {
14
- detail: IoEventMap[T];
15
- }) => void;
16
- type IoListeners = {
17
- [EventType in IoEventTypes]: CallbackListener<EventType>[];
18
- };
19
- export declare class IoEventEmitter {
20
- listeners: IoListeners;
21
- addEventListener<Q extends IoEventTypes>(name: Q, callback: CallbackListener<Q>): void;
22
- removeEventListener<Q extends IoEventTypes>(name: Q, callback: CallbackListener<Q>): void;
23
- dispatchEvent<T extends IoEventTypes>(dispatchName: T, context: IoEventMap[T]): void;
24
- }
25
- export {};
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IoEventEmitter = void 0;
4
- class IoEventEmitter {
5
- constructor() {
6
- this.listeners = {
7
- input: [],
8
- output: [],
9
- };
10
- }
11
- addEventListener(name, callback) {
12
- this.listeners[name].push(callback);
13
- }
14
- removeEventListener(name, callback) {
15
- this.listeners[name] = this.listeners[name].filter((l) => l !== callback);
16
- }
17
- dispatchEvent(dispatchName, context) {
18
- this.listeners[dispatchName].forEach((callback) => {
19
- callback({ detail: context });
20
- });
21
- }
22
- }
23
- exports.IoEventEmitter = IoEventEmitter;
@@ -1,15 +0,0 @@
1
- import type { AudioTrack } from '@remotion/media-parser';
2
- import type { ConvertMediaAudioCodec } from './codec-id';
3
- export type AudioOperation = 'reencode' | 'copy' | 'drop';
4
- export type ResolveAudioActionFn = (options: {
5
- canReencode: boolean;
6
- canCopy: boolean;
7
- }) => AudioOperation | Promise<AudioOperation>;
8
- export declare const defaultResolveAudioAction: ResolveAudioActionFn;
9
- export declare const resolveAudioAction: ({ audioDecoderConfig, audioEncoderConfig, track, audioCodec, resolverFunction, }: {
10
- audioDecoderConfig: AudioDecoderConfig | null;
11
- audioEncoderConfig: AudioEncoderConfig | null;
12
- track: AudioTrack;
13
- audioCodec: ConvertMediaAudioCodec;
14
- resolverFunction: ResolveAudioActionFn;
15
- }) => Promise<AudioOperation>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveAudioAction = exports.defaultResolveAudioAction = void 0;
4
- const canCopyAudioTrack = (inputCodec, outputCodec) => {
5
- if (outputCodec === 'opus') {
6
- return inputCodec === 'opus';
7
- }
8
- throw new Error(`Unhandled codec: ${outputCodec}`);
9
- };
10
- const defaultResolveAudioAction = ({ canReencode, canCopy, }) => {
11
- if (canCopy) {
12
- return 'copy';
13
- }
14
- if (canReencode) {
15
- return 'reencode';
16
- }
17
- // TODO: Make a fail option?
18
- return 'drop';
19
- };
20
- exports.defaultResolveAudioAction = defaultResolveAudioAction;
21
- const resolveAudioAction = async ({ audioDecoderConfig, audioEncoderConfig, track, audioCodec, resolverFunction, }) => {
22
- const canReencode = Boolean(audioDecoderConfig && audioEncoderConfig);
23
- const canCopy = canCopyAudioTrack(track.codecWithoutConfig, audioCodec);
24
- const resolved = await resolverFunction({
25
- canReencode,
26
- canCopy,
27
- });
28
- return resolved;
29
- };
30
- exports.resolveAudioAction = resolveAudioAction;
@@ -1,15 +0,0 @@
1
- import type { VideoTrack } from '@remotion/media-parser';
2
- import type { ConvertMediaVideoCodec } from './codec-id';
3
- export type VideoOperation = 'reencode' | 'copy' | 'drop';
4
- export type ResolveVideoActionFn = (options: {
5
- canReencode: boolean;
6
- canCopy: boolean;
7
- }) => VideoOperation | Promise<VideoOperation>;
8
- export declare const defaultResolveVideoAction: ResolveVideoActionFn;
9
- export declare const resolveVideoAction: ({ videoDecoderConfig, videoEncoderConfig, track, videoCodec, resolverFunction, }: {
10
- videoDecoderConfig: VideoDecoderConfig | null;
11
- videoEncoderConfig: VideoEncoderConfig | null;
12
- videoCodec: ConvertMediaVideoCodec;
13
- track: VideoTrack;
14
- resolverFunction: ResolveVideoActionFn;
15
- }) => Promise<VideoOperation>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveVideoAction = exports.defaultResolveVideoAction = void 0;
4
- const canCopyVideoTrack = (inputCodec, outputCodec) => {
5
- if (outputCodec === 'vp8') {
6
- return inputCodec === 'vp8';
7
- }
8
- if (outputCodec === 'vp9') {
9
- return inputCodec === 'vp9';
10
- }
11
- throw new Error(`Unhandled codec: ${outputCodec}`);
12
- };
13
- const defaultResolveVideoAction = ({ canReencode, canCopy, }) => {
14
- if (canCopy) {
15
- return 'copy';
16
- }
17
- if (canReencode) {
18
- return 'reencode';
19
- }
20
- // TODO: Make a fail option?
21
- return 'drop';
22
- };
23
- exports.defaultResolveVideoAction = defaultResolveVideoAction;
24
- const resolveVideoAction = async ({ videoDecoderConfig, videoEncoderConfig, track, videoCodec, resolverFunction, }) => {
25
- const canReencode = Boolean(videoDecoderConfig && videoEncoderConfig);
26
- const canCopy = canCopyVideoTrack(track.codecWithoutConfig, videoCodec);
27
- const resolved = await resolverFunction({
28
- canReencode,
29
- canCopy,
30
- });
31
- return resolved;
32
- };
33
- exports.resolveVideoAction = resolveVideoAction;
@@ -1,4 +0,0 @@
1
- export declare const waitUntilReturn: () => {
2
- waitForReturn: () => any;
3
- isReturning: () => void;
4
- };
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.waitUntilReturn = void 0;
4
- const with_resolvers_1 = require("./with-resolvers");
5
- const waitUntilReturn = () => {
6
- const { promise, resolve } = (0, with_resolvers_1.withResolvers)();
7
- return {
8
- waitForReturn: () => promise,
9
- isReturning: () => {
10
- resolve(undefined);
11
- },
12
- };
13
- };
14
- exports.waitUntilReturn = waitUntilReturn;