🎥 Make videos programmatically with React
progress
Jonny Burgera2ca071be449
diff --git a/packages/media-parser/src/options.ts b/packages/media-parser/src/options.tsindex e192514b03..a179043459 100644--- a/packages/media-parser/src/options.ts+++ b/packages/media-parser/src/options.ts@@ -144,61 +144,67 @@ export type MediaParserKeyframe = {export type MandatoryParseMediaCallbacks = {onDimensions:| null- | ((dimensions: Dimensions | null) => void | Promise<void>);+ | ((dimensions: Dimensions | null) => unknown | Promise<unknown>);onDurationInSeconds:| null- | ((durationInSeconds: number | null) => void | Promise<void>);+ | ((durationInSeconds: number | null) => unknown | Promise<unknown>);onSlowDurationInSeconds:| null- | ((durationInSeconds: number) => void | Promise<void>);- onSlowFps: null | ((fps: number) => void | Promise<void>);- onStructure: null | ((structure: Structure) => void | Promise<void>);- onFps: null | ((fps: number | null) => void | Promise<void>);+ | ((durationInSeconds: number) => unknown | Promise<unknown>);+ onSlowFps: null | ((fps: number) => unknown | Promise<unknown>);+ onStructure: null | ((structure: Structure) => unknown | Promise<unknown>);+ onFps: null | ((fps: number | null) => unknown | Promise<unknown>);onVideoCodec:| null- | ((codec: MediaParserVideoCodec | null) => void | Promise<void>);+ | ((codec: MediaParserVideoCodec | null) => unknown | Promise<unknown>);onAudioCodec:| null- | ((codec: MediaParserAudioCodec | null) => void | Promise<void>);- onTracks: null | ((tracks: TracksField) => void | Promise<void>);- onRotation: null | ((rotation: number | null) => void | Promise<void>);+ | ((codec: MediaParserAudioCodec | null) => unknown | Promise<unknown>);+ onTracks: null | ((tracks: TracksField) => unknown | Promise<unknown>);+ onRotation: null | ((rotation: number | null) => unknown | Promise<unknown>);onUnrotatedDimensions:| null- | ((dimensions: Dimensions | null) => void | Promise<void>);+ | ((dimensions: Dimensions | null) => unknown | Promise<unknown>);onInternalStats:| null- | ((internalStats: InternalStats) => void | Promise<void>);- onSize: null | ((size: number | null) => void | Promise<void>);- onName: null | ((name: string) => void | Promise<void>);+ | ((internalStats: InternalStats) => unknown | Promise<unknown>);+ onSize: null | ((size: number | null) => unknown | Promise<unknown>);+ onName: null | ((name: string) => unknown | Promise<unknown>);onContainer:| null- | ((container: MediaParserContainer) => void | Promise<void>);- onIsHdr: null | ((isHdr: boolean) => void | Promise<void>);- onMetadata: null | ((metadata: MetadataEntry[]) => void | Promise<void>);+ | ((container: MediaParserContainer) => unknown | Promise<unknown>);+ onIsHdr: null | ((isHdr: boolean) => unknown | Promise<unknown>);+ onMetadata:+ | null+ | ((metadata: MetadataEntry[]) => unknown | Promise<unknown>);onLocation:| null- | ((location: MediaParserLocation | null) => void | Promise<void>);- onMimeType: null | ((mimeType: string | null) => void | Promise<void>);+ | ((location: MediaParserLocation | null) => unknown | Promise<unknown>);+ onMimeType: null | ((mimeType: string | null) => unknown | Promise<unknown>);onKeyframes:| null- | ((keyframes: MediaParserKeyframe[] | null) => void | Promise<void>);+ | ((keyframes: MediaParserKeyframe[] | null) => unknown | Promise<unknown>);onSlowKeyframes:| null- | ((keyframes: MediaParserKeyframe[]) => void | Promise<void>);- onSlowNumberOfFrames: null | ((samples: number) => void | Promise<void>);+ | ((keyframes: MediaParserKeyframe[]) => unknown | Promise<unknown>);+ onSlowNumberOfFrames:+ | null+ | ((samples: number) => unknown | Promise<unknown>);onImages:| null- | ((images: MediaParserEmbeddedImage[]) => void | Promise<void>);- onSampleRate: null | ((sampleRate: number | null) => void | Promise<void>);+ | ((images: MediaParserEmbeddedImage[]) => unknown | Promise<unknown>);+ onSampleRate:+ | null+ | ((sampleRate: number | null) => unknown | Promise<unknown>);onNumberOfAudioChannels:| null- | ((numberOfChannels: number | null) => void | Promise<void>);+ | ((numberOfChannels: number | null) => unknown | Promise<unknown>);onSlowVideoBitrate:| null- | ((videoBitrate: number | null) => void | Promise<void>);+ | ((videoBitrate: number | null) => unknown | Promise<unknown>);onSlowAudioBitrate:| null- | ((audioBitrate: number | null) => void | Promise<void>);+ | ((audioBitrate: number | null) => unknown | Promise<unknown>);};export type ParseMediaCallbacks = Partial<MandatoryParseMediaCallbacks>;diff --git a/packages/webcodecs/src/create/iso-base-media/create-iso-base-media.ts b/packages/webcodecs/src/create/iso-base-media/create-iso-base-media.tsindex eb1300564e..e6d1567fdb 100644--- a/packages/webcodecs/src/create/iso-base-media/create-iso-base-media.ts+++ b/packages/webcodecs/src/create/iso-base-media/create-iso-base-media.ts@@ -26,7 +26,11 @@ export const createIsoBaseMedia = async ({minorBrand: 512,});- const w = await writer.createContent({filename, mimeType: 'video/mp4'});+ const w = await writer.createContent({+ filename,+ mimeType: 'video/mp4',+ logLevel,+ });await w.write(header);let globalDurationInUnits = 0;diff --git a/packages/webcodecs/src/create/matroska/create-matroska-media.ts b/packages/webcodecs/src/create/matroska/create-matroska-media.tsindex d487d8d0ca..fafa93f086 100644--- a/packages/webcodecs/src/create/matroska/create-matroska-media.ts+++ b/packages/webcodecs/src/create/matroska/create-matroska-media.ts@@ -34,7 +34,11 @@ export const createMatroskaMedia = async ({}: MediaFnGeneratorInput): Promise<MediaFn> => {const header = makeMatroskaHeader();- const w = await writer.createContent({filename, mimeType: 'video/webm'});+ const w = await writer.createContent({+ filename,+ mimeType: 'video/webm',+ logLevel,+ });await w.write(header.bytes);const matroskaInfo = makeMatroskaInfo({timescale,diff --git a/packages/webcodecs/src/create/wav/create-wav.ts b/packages/webcodecs/src/create/wav/create-wav.tsindex fba4b6498b..f4b405063d 100644--- a/packages/webcodecs/src/create/wav/create-wav.ts+++ b/packages/webcodecs/src/create/wav/create-wav.ts@@ -26,7 +26,11 @@ export const createWav = async ({writer,progressTracker,}: MediaFnGeneratorInput): Promise<MediaFn> => {- const w = await writer.createContent({filename, mimeType: 'audio/wav'});+ const w = await writer.createContent({+ filename,+ mimeType: 'audio/wav',+ logLevel,+ });await w.write(new Uint8Array([0x52, 0x49, 0x46, 0x46])); // "RIFF"const sizePosition = w.getWrittenByteCount();