werift 0.14.4 → 0.14.5
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.
|
@@ -25,7 +25,7 @@ const __1 = require("../../..");
|
|
|
25
25
|
const _1 = require(".");
|
|
26
26
|
class WebmFactory extends _1.MediaWriter {
|
|
27
27
|
start(tracks) {
|
|
28
|
-
this.webm = new __1.WebmOutput(fs,
|
|
28
|
+
this.webm = new __1.WebmOutput(fs, this.path, tracks.map((track, i) => {
|
|
29
29
|
const trackNumber = i + 1;
|
|
30
30
|
const payloadType = track.codec.payloadType;
|
|
31
31
|
if (track.kind === "video") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webm.js","sourceRoot":"","sources":["../../../../../../src/nonstandard/recorder/writer/webm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAGlC,gCAKkB;AAClB,wBAAgC;AAEhC,MAAa,WAAY,SAAQ,cAAW;IAG1C,KAAK,CAAC,MAA0B;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,cAAU,CACxB,EAAE,EACF,
|
|
1
|
+
{"version":3,"file":"webm.js","sourceRoot":"","sources":["../../../../../../src/nonstandard/recorder/writer/webm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAGlC,gCAKkB;AAClB,wBAAgC;AAEhC,MAAa,WAAY,SAAQ,cAAW;IAG1C,KAAK,CAAC,MAA0B;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,cAAU,CACxB,EAAE,EACF,IAAI,CAAC,IAAI,EACT,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;YACtB,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAM,CAAC,WAAW,CAAC;YAE7C,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;gB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AI,CAAC,aAAa,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,IAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;CACF;AA9DD,kCA8DC;AAED,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC","sourcesContent":["import * as fs from \"fs/promises\";\n\nimport { SupportedCodec } from \"../../../../../rtp/src/container/webm\";\nimport {\n JitterBuffer,\n MediaStreamTrack,\n SampleBuilder,\n WebmOutput,\n} from \"../../..\";\nimport { MediaWriter } from \".\";\n\nexport class WebmFactory extends MediaWriter {\n webm?: WebmOutput;\n\n start(tracks: MediaStreamTrack[]) {\n this.webm = new WebmOutput(\n fs,\n this.path,\n tracks.map((track, i) => {\n const trackNumber = i + 1;\n const payloadType = track.codec!.payloadType;\n\n if (track.kind === \"video\") {\n const codec = ((): SupportedCodec => {\n switch (track.codec?.name.toLowerCase() as SupportedVideoCodec) {\n case \"vp8\":\n return \"VP8\";\n case \"vp9\":\n return \"VP9\";\n case \"h264\":\n return \"MPEG4/ISO/AVC\";\n case \"av1x\":\n return \"AV1\";\n default:\n throw new Error();\n }\n })();\n return {\n kind: \"video\",\n clockRate: 90000,\n payloadType,\n trackNumber,\n codec,\n width: this.options.width,\n height: this.options.height,\n };\n } else {\n return {\n kind: \"audio\",\n clockRate: 48000,\n payloadType,\n trackNumber,\n codec: \"OPUS\",\n };\n }\n })\n );\n\n tracks.forEach((track) => {\n const sampleBuilder =\n track.kind === \"video\"\n ? new SampleBuilder((h) => !!h.marker).pipe(this.webm!)\n : new SampleBuilder(() => true).pipe(this.webm!);\n new JitterBuffer({\n rtpStream: track.onReceiveRtp,\n rtcpStream: track.onReceiveRtcp,\n }).pipe(sampleBuilder);\n });\n }\n\n async stop() {\n await this.webm!.stop();\n }\n}\n\nconst supportedVideoCodecs = [\"h264\", \"vp8\", \"vp9\", \"av1x\"] as const;\ntype SupportedVideoCodec = typeof supportedVideoCodecs[number];\n"]}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export class WebmFactory extends MediaWriter {
|
|
|
15
15
|
start(tracks: MediaStreamTrack[]) {
|
|
16
16
|
this.webm = new WebmOutput(
|
|
17
17
|
fs,
|
|
18
|
-
|
|
18
|
+
this.path,
|
|
19
19
|
tracks.map((track, i) => {
|
|
20
20
|
const trackNumber = i + 1;
|
|
21
21
|
const payloadType = track.codec!.payloadType;
|