Continue API sketch

This commit is contained in:
David Payr
2024-10-31 17:34:48 +01:00
parent 5ffd91f1ea
commit 9a35288c17
+36 -2
View File
@@ -10,8 +10,31 @@ class StreamTarget extends Target {
} }
abstract class OutputFormat {
}
class Mp4OutputFormat extends OutputFormat {
constructor(options: {
fastStart: false | 'in-memory' | 'fragmented' | {
expectedVideoChunks?: number,
expectedAudioChunks?: number
},
}) {
super();
}
}
class WebMOutputFormat extends OutputFormat {
}
class MkvOutputFormat extends OutputFormat {
}
type OutputOptions = { type OutputOptions = {
format: 'mp4' | 'webm' | 'mkv', format: OutputFormat,
target: Target target: Target
}; };
@@ -41,7 +64,16 @@ abstract class InputSource {
} }
class InputFormat {
constructor(format: string) {}
}
const MP4_INPUT_FORMAT = new InputFormat('mp4');
const WEB_M_INPUT_FORMAT = new InputFormat('webm');
const MKV_INPUT_FORMAT = new InputFormat('mkv');
type InputOptions = { type InputOptions = {
formats: InputFormat[],
source: InputSource source: InputSource
}; };
@@ -114,7 +146,9 @@ class MediaStreamTrackAudioSource extends AudioSource {
} }
let output = new Output({ let output = new Output({
format: 'mp4', format: new Mp4OutputFormat({
fastStart: false
}),
target: new ArrayBufferTarget() target: new ArrayBufferTarget()
}); });