@ascegu/teamily 1.0.26 → 1.0.27
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/package.json +1 -1
- package/src/monitor.ts +28 -5
- package/src/upload.ts +38 -6
package/package.json
CHANGED
package/src/monitor.ts
CHANGED
|
@@ -50,6 +50,26 @@ if (typeof globalThis.FileReader === "undefined") {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// Minimal valid 1x1 white JPEG. Used as a placeholder video snapshot —
|
|
54
|
+
// the SDK requires a non-empty snapshot file for upload; an empty File hangs.
|
|
55
|
+
// prettier-ignore
|
|
56
|
+
const MINIMAL_JPEG = new Uint8Array([
|
|
57
|
+
0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
|
|
58
|
+
0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43,
|
|
59
|
+
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
60
|
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
61
|
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
62
|
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
63
|
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
64
|
+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0xc0, 0x00, 0x0b, 0x08, 0x00,
|
|
65
|
+
0x01, 0x00, 0x01, 0x01, 0x01, 0x11, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x00,
|
|
66
|
+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
67
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x10, 0x01, 0x00,
|
|
68
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
69
|
+
0x00, 0x00, 0x00, 0xff, 0xda, 0x00, 0x08, 0x01, 0x01, 0x00, 0x00, 0x3f,
|
|
70
|
+
0x00, 0x7b, 0x40, 0x00, 0x00, 0x01, 0xff, 0xd9,
|
|
71
|
+
]);
|
|
72
|
+
|
|
53
73
|
// Lazy-loaded SDK to avoid top-level dynamic import issues
|
|
54
74
|
let sdkModule: SdkModule | null = null;
|
|
55
75
|
async function loadSDK() {
|
|
@@ -280,8 +300,11 @@ export class TeamilyMonitor {
|
|
|
280
300
|
): Promise<string> {
|
|
281
301
|
const sdk = this.requireSdk();
|
|
282
302
|
const videoFile = new File([new Uint8Array(buffer)], fileName, { type: contentType });
|
|
283
|
-
// snapshotFile is required by the SDK
|
|
284
|
-
|
|
303
|
+
// snapshotFile is required by the SDK; an empty file causes the upload to hang.
|
|
304
|
+
// Use a minimal valid 1x1 JPEG so the SDK upload succeeds.
|
|
305
|
+
const snapshotFile = new File([new Uint8Array(MINIMAL_JPEG)], "snapshot.jpg", {
|
|
306
|
+
type: "image/jpeg",
|
|
307
|
+
});
|
|
285
308
|
const created = await sdk.createVideoMessageByFile({
|
|
286
309
|
videoPath: "",
|
|
287
310
|
duration: 0,
|
|
@@ -291,10 +314,10 @@ export class TeamilyMonitor {
|
|
|
291
314
|
videoUrl: "",
|
|
292
315
|
videoSize: buffer.length,
|
|
293
316
|
snapshotUUID: crypto.randomUUID(),
|
|
294
|
-
snapshotSize:
|
|
317
|
+
snapshotSize: MINIMAL_JPEG.length,
|
|
295
318
|
snapshotUrl: "",
|
|
296
|
-
snapshotWidth:
|
|
297
|
-
snapshotHeight:
|
|
319
|
+
snapshotWidth: 1,
|
|
320
|
+
snapshotHeight: 1,
|
|
298
321
|
videoFile,
|
|
299
322
|
snapshotFile,
|
|
300
323
|
});
|
package/src/upload.ts
CHANGED
|
@@ -14,12 +14,44 @@ export function detectMediaCategory(filePath: string): MediaCategory {
|
|
|
14
14
|
if ([".mp3", ".m4a", ".wav", ".ogg"].includes(ext)) return "audio";
|
|
15
15
|
if (
|
|
16
16
|
[
|
|
17
|
-
".pdf",
|
|
18
|
-
".
|
|
19
|
-
".
|
|
20
|
-
".
|
|
21
|
-
".
|
|
22
|
-
".
|
|
17
|
+
".pdf",
|
|
18
|
+
".doc",
|
|
19
|
+
".docx",
|
|
20
|
+
".xls",
|
|
21
|
+
".xlsx",
|
|
22
|
+
".ppt",
|
|
23
|
+
".pptx",
|
|
24
|
+
".zip",
|
|
25
|
+
".rar",
|
|
26
|
+
".7z",
|
|
27
|
+
".tar",
|
|
28
|
+
".gz",
|
|
29
|
+
".tgz",
|
|
30
|
+
".txt",
|
|
31
|
+
".csv",
|
|
32
|
+
".json",
|
|
33
|
+
".xml",
|
|
34
|
+
".yaml",
|
|
35
|
+
".yml",
|
|
36
|
+
".log",
|
|
37
|
+
".md",
|
|
38
|
+
".html",
|
|
39
|
+
".css",
|
|
40
|
+
".js",
|
|
41
|
+
".ts",
|
|
42
|
+
".py",
|
|
43
|
+
".go",
|
|
44
|
+
".rs",
|
|
45
|
+
".java",
|
|
46
|
+
".c",
|
|
47
|
+
".cpp",
|
|
48
|
+
".h",
|
|
49
|
+
".sh",
|
|
50
|
+
".bat",
|
|
51
|
+
".sql",
|
|
52
|
+
".toml",
|
|
53
|
+
".ini",
|
|
54
|
+
".cfg",
|
|
23
55
|
].includes(ext)
|
|
24
56
|
)
|
|
25
57
|
return "file";
|