diff --git a/server/package.json b/server/package.json index 061b2c9..abb34c7 100644 --- a/server/package.json +++ b/server/package.json @@ -4,6 +4,7 @@ "@types/express-ws": "^3.0.1", "@types/fluent-ffmpeg": "^2.1.20", "@types/js-yaml": "^4.0.5", + "@types/mp4frag": "^0.6.1", "@types/node": "^18.11.4", "@types/node-fetch": "^2.6.2", "@types/ws": "^8.5.3", diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index 8cb2abe..dfeca1a 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -5,6 +5,7 @@ specifiers: '@types/express-ws': ^3.0.1 '@types/fluent-ffmpeg': ^2.1.20 '@types/js-yaml': ^4.0.5 + '@types/mp4frag': ^0.6.1 '@types/node': ^18.11.4 '@types/node-fetch': ^2.6.2 '@types/ws': ^8.5.3 @@ -32,6 +33,7 @@ devDependencies: '@types/express-ws': 3.0.1 '@types/fluent-ffmpeg': 2.1.20 '@types/js-yaml': 4.0.5 + '@types/mp4frag': 0.6.1 '@types/node': 18.11.4 '@types/node-fetch': 2.6.2 '@types/ws': 8.5.3 @@ -131,6 +133,12 @@ packages: resolution: {integrity: sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==} dev: true + /@types/mp4frag/0.6.1: + resolution: {integrity: sha512-t5VL9dPiMmFwClo4j6tdVUhlflWtC3JKR046u/gOj7cNuCBR2DpmntMteiqOsFK2Ac5pMybShlHrPIPNQTWqKQ==} + dependencies: + '@types/node': 18.11.4 + dev: true + /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: diff --git a/server/src/mp4frag.d.ts b/server/src/mp4frag.d.ts deleted file mode 100644 index 2e06ff9..0000000 --- a/server/src/mp4frag.d.ts +++ /dev/null @@ -1,155 +0,0 @@ -declare module 'mp4frag' { - import { Transform } from 'stream'; - - namespace Mp4Frag { - interface SegmentObject { - segment: Buffer; - sequence: number; - duration: number; - timestamp: number; - keyframe: number; - } - } - - export = Mp4Frag; - - /** - * @fileOverview - *
{segment, sequence, duration, timestamp, keyframe}
- *
- * - Returns {segment: null, sequence: -1, duration: -1; timestamp: -1, keyframe: -1} if requested before first [segment event]{@link Mp4Frag#event:segment}.
- */
- get segmentObject(): Mp4Frag.SegmentObject;
- /**
- * - Returns the timestamp of the latest Mp4 segment as an Integer(milliseconds).
- *
- * - Returns -1 if requested before first [segment event]{@link Mp4Frag#event:segment}.
- */
- get timestamp(): number;
- /**
- * - Returns the duration of latest Mp4 segment as a Float(seconds).
- *
- * - Returns -1 if requested before first [segment event]{@link Mp4Frag#event:segment}.
- */
- get duration(): number;
- /**
- * - Returns the total duration of all Mp4 segments as a Float(seconds).
- *
- * - Returns -1 if requested before first [segment event]{@link Mp4Frag#event:segment}.
- */
- get totalDuration(): number;
- /**
- * - Returns the total byte length of the Mp4 initialization and all Mp4 segments as ant Int(bytes).
- *
- * - Returns -1 if requested before [initialized event]{@link Mp4Frag#event:initialized}.
- */
- get totalByteLength(): number;
- /**
- * - Returns the fmp4 HLS m3u8 playlist as a String.
- *
- * - Returns Null if requested before [initialized event]{@link Mp4Frag#event:initialized}.
- */
- get m3u8(): string | null;
- /**
- * - Returns the sequence of the latest Mp4 segment as an Integer.
- *
- * - Returns -1 if requested before first [segment event]{@link Mp4Frag#event:segment}.
- */
- get sequence(): number;
- /**
- * - Returns the nal keyframe index of the latest Mp4 segment as an Integer.
- *
- * - Returns -1 if segment contains no keyframe nal.
- */
- get keyframe(): number;
- /**
- * - Returns a boolean indicating if all segments contain a keyframe.
- *
- * - Returns false if any segments do not contain a keyframe.
- */
- get allKeyframes(): boolean;
- /**
- * - Returns the Mp4 segments as an Array of Objects
- *
- * - [{segment, sequence, duration, timestamp, keyframe},...]
- *
- * - Returns Null if requested before first [segment event]{@link Mp4Frag#event:segment}.
- */
- get segmentObjects(): Mp4Frag.SegmentObject[];
- /**
- * @param {Number|String} sequence - sequence number
- * @returns {Object|null}
- * - Returns the Mp4 segment that corresponds to the numbered sequence as an Object.
- *
- * - {segment, sequence, duration, timestamp, keyframe}
- *
- * - Returns Null if there is no segment that corresponds to sequence number.
- */
- getSegmentObject(sequence: number | string): Mp4Frag.SegmentObject | null;
- /**
- * Clear cached values
- */
- resetCache(): void;
- }
-}