@invintusmedia/tomp4 1.0.1 → 1.0.2

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.
package/dist/tomp4.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * toMp4.js v1.0.1
2
+ * toMp4.js v1.0.2
3
3
  * Convert MPEG-TS and fMP4 to standard MP4
4
4
  * https://github.com/TVWIT/toMp4.js
5
5
  * MIT License
@@ -1611,7 +1611,7 @@
1611
1611
  toMp4.isMpegTs = isMpegTs;
1612
1612
  toMp4.isFmp4 = isFmp4;
1613
1613
  toMp4.isStandardMp4 = isStandardMp4;
1614
- toMp4.version = '1.0.1';
1614
+ toMp4.version = '1.0.2';
1615
1615
 
1616
1616
  return toMp4;
1617
1617
  });
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "@invintusmedia/tomp4",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Convert MPEG-TS and fMP4 streams to standard MP4 - pure JavaScript, zero dependencies",
5
- "main": "dist/tomp4.js",
5
+ "main": "src/index.js",
6
6
  "module": "src/index.js",
7
+ "types": "src/index.d.ts",
7
8
  "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./src/index.js",
12
+ "require": "./dist/tomp4.js",
13
+ "types": "./src/index.d.ts"
14
+ }
15
+ },
8
16
  "files": [
9
17
  "src",
10
18
  "dist"
package/src/index.d.ts ADDED
@@ -0,0 +1,99 @@
1
+ declare module '@invintusmedia/tomp4' {
2
+ export interface Mp4Result {
3
+ /** Raw MP4 data */
4
+ data: Uint8Array;
5
+ /** Suggested filename */
6
+ filename: string;
7
+ /** Size in bytes */
8
+ size: number;
9
+ /** Human-readable size (e.g. "2.5 MB") */
10
+ sizeFormatted: string;
11
+ /** Get as Blob */
12
+ toBlob(): Blob;
13
+ /** Get as object URL for video.src */
14
+ toURL(): string;
15
+ /** Revoke the object URL to free memory */
16
+ revokeURL(): void;
17
+ /** Trigger browser download */
18
+ download(filename?: string): void;
19
+ /** Get as ArrayBuffer */
20
+ toArrayBuffer(): ArrayBuffer;
21
+ }
22
+
23
+ export interface HlsVariant {
24
+ url: string;
25
+ bandwidth: number;
26
+ resolution?: string;
27
+ width?: number;
28
+ height?: number;
29
+ codecs?: string;
30
+ }
31
+
32
+ export interface HlsStream {
33
+ masterUrl: string;
34
+ variants: HlsVariant[];
35
+ qualities: string[];
36
+ select(quality: string | number): HlsStream;
37
+ segments: string[];
38
+ }
39
+
40
+ export interface ToMp4Options {
41
+ /** Progress callback */
42
+ onProgress?: (message: string) => void;
43
+ /** Suggested filename for downloads */
44
+ filename?: string;
45
+ /** HLS quality: 'highest', 'lowest', or bandwidth number */
46
+ quality?: 'highest' | 'lowest' | number;
47
+ /** Max HLS segments to download */
48
+ maxSegments?: number;
49
+ }
50
+
51
+ /**
52
+ * Convert video to MP4
53
+ * @param input - URL, HLS stream, or video data
54
+ * @param options - Conversion options
55
+ */
56
+ function toMp4(
57
+ input: string | Uint8Array | ArrayBuffer | Blob | HlsStream,
58
+ options?: ToMp4Options
59
+ ): Promise<Mp4Result>;
60
+
61
+ namespace toMp4 {
62
+ /** Library version */
63
+ const version: string;
64
+
65
+ /** Convert MPEG-TS data to MP4 */
66
+ function fromTs(data: Uint8Array | ArrayBuffer, options?: ToMp4Options): Mp4Result;
67
+
68
+ /** Convert fMP4 data to MP4 */
69
+ function fromFmp4(data: Uint8Array | ArrayBuffer): Mp4Result;
70
+
71
+ /** Detect format of video data */
72
+ function detectFormat(data: Uint8Array): 'mpegts' | 'fmp4' | 'mp4' | 'unknown';
73
+
74
+ /** Check if data is MPEG-TS */
75
+ function isMpegTs(data: Uint8Array): boolean;
76
+
77
+ /** Check if data is fMP4 */
78
+ function isFmp4(data: Uint8Array): boolean;
79
+
80
+ /** Check if data is standard MP4 */
81
+ function isStandardMp4(data: Uint8Array): boolean;
82
+
83
+ /** Parse HLS playlist */
84
+ function parseHls(url: string): Promise<HlsStream>;
85
+
86
+ /** Download and combine HLS segments */
87
+ function downloadHls(
88
+ input: string | HlsStream,
89
+ options?: ToMp4Options
90
+ ): Promise<Uint8Array>;
91
+
92
+ /** Check if URL is an HLS playlist */
93
+ function isHlsUrl(url: string): boolean;
94
+ }
95
+
96
+ export default toMp4;
97
+ export { toMp4 };
98
+ }
99
+
package/src/index.js CHANGED
@@ -290,7 +290,7 @@ toMp4.downloadHls = downloadHls;
290
290
  toMp4.isHlsUrl = isHlsUrl;
291
291
 
292
292
  // Version (injected at build time for dist, read from package.json for ESM)
293
- toMp4.version = '1.0.1';
293
+ toMp4.version = '1.0.2';
294
294
 
295
295
  // Export
296
296
  export {