@vorec/cli 1.0.0 → 1.1.0
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/commands/run.js +26 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/commands/run.js
CHANGED
|
@@ -10,6 +10,7 @@ export async function runCommand(manifestPath, opts) {
|
|
|
10
10
|
console.log(`Actions: ${manifest.actions.length}, URL: ${manifest.url}\n`);
|
|
11
11
|
// Record → upload → generate
|
|
12
12
|
let videoPath = opts.video;
|
|
13
|
+
let thumbPath;
|
|
13
14
|
let trackedActions = [];
|
|
14
15
|
let videoDuration = 0;
|
|
15
16
|
let videoWidth = manifest.viewport?.width || 1920;
|
|
@@ -20,6 +21,7 @@ export async function runCommand(manifestPath, opts) {
|
|
|
20
21
|
try {
|
|
21
22
|
const result = await recordAndTrack(manifest);
|
|
22
23
|
videoPath = result.videoPath;
|
|
24
|
+
thumbPath = result.thumbPath;
|
|
23
25
|
trackedActions = result.actions;
|
|
24
26
|
videoDuration = result.duration;
|
|
25
27
|
videoWidth = result.viewport.width;
|
|
@@ -77,6 +79,21 @@ export async function runCommand(manifestPath, opts) {
|
|
|
77
79
|
});
|
|
78
80
|
spinner.text = 'Uploading video...';
|
|
79
81
|
await uploadVideo(createResult.upload_url, videoPath, contentType);
|
|
82
|
+
// Upload thumbnail if available
|
|
83
|
+
let thumbnailKey;
|
|
84
|
+
if (thumbPath) {
|
|
85
|
+
try {
|
|
86
|
+
spinner.text = 'Uploading thumbnail...';
|
|
87
|
+
const thumbResult = await apiCall('upload-thumbnail', {
|
|
88
|
+
projectId: createResult.projectId,
|
|
89
|
+
});
|
|
90
|
+
if (thumbResult.upload_url) {
|
|
91
|
+
await uploadVideo(thumbResult.upload_url, thumbPath, 'image/jpeg');
|
|
92
|
+
thumbnailKey = thumbResult.storage_key;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch { /* thumbnail upload failed — not critical */ }
|
|
96
|
+
}
|
|
80
97
|
spinner.text = 'Confirming upload...';
|
|
81
98
|
await apiCall('confirm-upload', {
|
|
82
99
|
projectId: createResult.projectId,
|
|
@@ -84,6 +101,7 @@ export async function runCommand(manifestPath, opts) {
|
|
|
84
101
|
video_duration: videoDuration > 0 ? videoDuration : undefined,
|
|
85
102
|
video_width: videoWidth,
|
|
86
103
|
video_height: videoHeight,
|
|
104
|
+
thumbnail_key: thumbnailKey,
|
|
87
105
|
});
|
|
88
106
|
saveProjectState({
|
|
89
107
|
projectId: createResult.projectId,
|
|
@@ -296,6 +314,13 @@ async function recordAndTrack(manifest) {
|
|
|
296
314
|
unlinkSync(webmPath);
|
|
297
315
|
}
|
|
298
316
|
catch { }
|
|
317
|
+
// Extract thumbnail at 2 seconds
|
|
318
|
+
const thumbPath = mp4Path.replace(/\.mp4$/, '_thumb.jpg');
|
|
319
|
+
try {
|
|
320
|
+
execSync(`ffmpeg -y -i "${mp4Path}" -ss 00:00:02 -frames:v 1 -q:v 2 "${thumbPath}"`, { stdio: 'pipe' });
|
|
321
|
+
console.log(' Thumbnail extracted');
|
|
322
|
+
}
|
|
323
|
+
catch { /* thumbnail extraction failed — not critical */ }
|
|
299
324
|
writeFileSync('.vorec/tracked-actions.json', JSON.stringify(tracked, null, 2));
|
|
300
|
-
return { videoPath: mp4Path, actions: tracked, duration, viewport };
|
|
325
|
+
return { videoPath: mp4Path, thumbPath: existsSync(thumbPath) ? thumbPath : undefined, actions: tracked, duration, viewport };
|
|
301
326
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { statusCommand } from './commands/status.js';
|
|
|
7
7
|
const program = new Command()
|
|
8
8
|
.name('vorec')
|
|
9
9
|
.description('Turn screen recordings into narrated tutorials')
|
|
10
|
-
.version('1.
|
|
10
|
+
.version('1.1.0');
|
|
11
11
|
program
|
|
12
12
|
.command('init')
|
|
13
13
|
.description('Save your Vorec API key')
|