dashcam 1.0.1-beta.5 → 1.0.1-beta.6

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/lib/recorder.js CHANGED
@@ -278,8 +278,11 @@ export async function startRecording({
278
278
  // Construct FFmpeg command arguments
279
279
  const platformArgs = await getPlatformArgs({ fps, includeAudio });
280
280
  const outputArgs = [
281
- '-c:v', 'libvpx', // Use VP8 codec instead of VP9 for better compatibility
282
- '-b:v', '1M', // Set specific bitrate instead of variable
281
+ '-c:v', 'libvpx-vp9', // Use VP9 codec for better quality and compression
282
+ '-quality', 'good', // Use good quality preset for better encoding
283
+ '-cpu-used', '2', // Higher quality encoding (0-5, lower = slower but better quality)
284
+ '-deadline', 'good', // Good quality encoding mode
285
+ '-b:v', '5M', // Higher bitrate for better quality
283
286
  // Remove explicit pixel format to let ffmpeg handle conversion automatically
284
287
  '-r', fps.toString(), // Ensure output framerate matches input
285
288
  '-g', '30', // Keyframe every 30 frames
@@ -358,13 +361,11 @@ export async function startRecording({
358
361
  all: true, // Capture both stdout and stderr
359
362
  stdin: 'pipe' // Enable stdin for sending 'q' to stop recording
360
363
  });
361
-
362
- recordingStartTime = Date.now();
363
364
 
364
365
  logger.info('FFmpeg process spawned', {
365
366
  pid: currentRecording.pid,
366
367
  args: args.slice(-5), // Log last 5 args including output file
367
- tempFile
368
+ tempFile
368
369
  });
369
370
 
370
371
  // Check if temp file gets created within first few seconds
@@ -392,6 +393,14 @@ export async function startRecording({
392
393
  directory: path.dirname(outputPath)
393
394
  });
394
395
 
396
+ // Set recording start time AFTER log tracker is initialized
397
+ // This ensures the timeline starts when the tracker is ready to capture events
398
+ recordingStartTime = Date.now();
399
+ logger.info('Recording timeline started', {
400
+ recordingStartTime,
401
+ recordingStartTimeReadable: new Date(recordingStartTime).toISOString()
402
+ });
403
+
395
404
  if (currentRecording.all) {
396
405
  currentRecording.all.setEncoding('utf8');
397
406
  currentRecording.all.on('data', (data) => {
@@ -622,6 +631,12 @@ export async function stopRecording() {
622
631
  icons: appTrackingResults.icons, // Include application icons metadata
623
632
  logs: logTrackingResults // Include log tracking results
624
633
  };
634
+
635
+ logger.info('Recording stopped with clientStartDate', {
636
+ clientStartDate: recordingStartTime,
637
+ clientStartDateReadable: new Date(recordingStartTime).toISOString(),
638
+ duration: result.duration
639
+ });
625
640
 
626
641
  currentRecording = null;
627
642
  recordingStartTime = null;
@@ -1,5 +1,6 @@
1
1
  import { Tail } from 'tail';
2
2
  import { logger } from '../logger.js';
3
+ import fs from 'fs';
3
4
 
4
5
  // Simple function to get stats for events in the last minute
5
6
  function getStats(eventTimes = []) {
@@ -40,6 +41,12 @@ export class FileTracker {
40
41
  this.trackedFile = trackedFile;
41
42
 
42
43
  try {
44
+ // Ensure the file exists before creating the Tail watcher
45
+ if (!fs.existsSync(this.trackedFile)) {
46
+ logger.warn(`File does not exist, creating: ${this.trackedFile}`);
47
+ fs.writeFileSync(this.trackedFile, '', 'utf8');
48
+ }
49
+
43
50
  this.tail = new Tail(this.trackedFile, { encoding: 'ascii' });
44
51
  this.tail.on('line', (line) => {
45
52
  const time = Date.now();
@@ -55,6 +55,7 @@ export class LogsTracker {
55
55
 
56
56
  this.files[filePath] = {
57
57
  status,
58
+ filePath, // Store file path for later reference
58
59
  unsubscribe: this.fileTrackerManager.subscribe(filePath, callback),
59
60
  };
60
61
 
@@ -98,13 +99,25 @@ export class LogsTracker {
98
99
 
99
100
  getStatus() {
100
101
  let items = [];
102
+ let filePathMap = {};
103
+
101
104
  if (this.isWatchOnly) {
102
- items = Object.keys(this.files).map((filePath) => ({
103
- ...this.fileTrackerManager.getStats(filePath),
104
- item: this.fileToIndex[filePath],
105
- }));
105
+ items = Object.keys(this.files).map((filePath) => {
106
+ const index = this.fileToIndex[filePath];
107
+ filePathMap[index] = filePath;
108
+ return {
109
+ ...this.fileTrackerManager.getStats(filePath),
110
+ item: index, // Keep numeric index to match events
111
+ };
112
+ });
106
113
  } else {
107
- items = Object.values(this.files).map(({ status }) => status);
114
+ items = Object.values(this.files).map(({ status, filePath }) => {
115
+ const index = status.item;
116
+ filePathMap[index] = filePath;
117
+ return {
118
+ ...status,
119
+ };
120
+ });
108
121
  }
109
122
 
110
123
  const totalCount = items.reduce((acc, status) => acc + status.count, 0);
@@ -112,11 +125,12 @@ export class LogsTracker {
112
125
  return [
113
126
  {
114
127
  id: 'CLI',
115
- name: 'CLI',
128
+ name: 'File Logs', // More descriptive name
116
129
  type: 'cli',
117
130
  fileLocation: this.fileLocation,
118
131
  items: items,
119
132
  count: totalCount,
133
+ filePathMap: filePathMap, // Include mapping for UI to display file paths
120
134
  },
121
135
  ];
122
136
  }
@@ -126,7 +140,7 @@ export class LogsTracker {
126
140
  const status = this.getStatus();
127
141
  return status.length > 0 ? status[0] : {
128
142
  id: 'CLI',
129
- name: 'CLI',
143
+ name: 'File Logs',
130
144
  type: 'cli',
131
145
  fileLocation: this.fileLocation,
132
146
  items: [],
package/lib/uploader.js CHANGED
@@ -371,8 +371,12 @@ export async function upload(filePath, metadata = {}) {
371
371
  for (const logStatus of trimmedLogs) {
372
372
  if (logStatus.count > 0 && logStatus.trimmedFileLocation && fs.existsSync(logStatus.trimmedFileLocation)) {
373
373
  try {
374
+ // Use the name from the status, or a default descriptive name
375
+ // The name is what shows in the "App" dropdown, not the file path
376
+ let logName = logStatus.name || 'File Logs';
377
+
374
378
  logger.debug('Creating log STS credentials', {
375
- name: logStatus.name || `Log ${logStatus.id}`,
379
+ name: logName,
376
380
  type: logStatus.type,
377
381
  count: logStatus.count
378
382
  });
@@ -380,7 +384,7 @@ export async function upload(filePath, metadata = {}) {
380
384
  const logSts = await auth.createLogSts(
381
385
  newReplay.replay.id,
382
386
  logStatus.id || `log-${Date.now()}`,
383
- logStatus.name || `Log ${logStatus.id}`,
387
+ logName,
384
388
  logStatus.type || 'application'
385
389
  );
386
390
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashcam",
3
- "version": "1.0.1-beta.5",
3
+ "version": "1.0.1-beta.6",
4
4
  "description": "Minimal CLI version of Dashcam desktop app",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
@@ -55,6 +55,9 @@
55
55
  "@yao-pkg/pkg": "^6.10.1",
56
56
  "esbuild": "^0.19.0"
57
57
  },
58
+ "overrides": {
59
+ "@mapbox/node-pre-gyp": "^2.0.0"
60
+ },
58
61
  "type": "module",
59
62
  "engines": {
60
63
  "node": ">=20.0.0"
package/test_workflow.sh CHANGED
@@ -30,44 +30,93 @@ if [ ! -f "$TEMP_FILE" ]; then
30
30
  fi
31
31
  echo "✅ File tracking configured"
32
32
 
33
- # 4. Start background process that logs current time to the temporary file
33
+ # 4. Start dashcam recording in background
34
34
  echo ""
35
- echo "4. Starting background logging process..."
36
- (
37
- while true; do
38
- echo "$(date): Current time logged" >> "$TEMP_FILE"
39
- sleep 2
40
- done
41
- ) &
42
- LOGGER_PID=$!
43
- echo "✅ Background logger started (PID: $LOGGER_PID)"
35
+ echo "4. Starting dashcam recording in background..."
36
+ # Start recording and redirect output to a log file so we can still monitor it
37
+ ./bin/dashcam.js record --title "Sync Test Recording" --description "Testing video/log synchronization with timestamped events" > /tmp/dashcam-recording.log 2>&1 &
38
+ RECORD_PID=$!
44
39
 
45
- # 5. Start dashcam recording in background
40
+ # Wait for recording to initialize and log tracker to start
41
+ echo "Waiting for recording to initialize (PID: $RECORD_PID)..."
42
+ sleep 1
43
+
44
+ # Write first event after log tracker is fully ready
45
+ RECORDING_START=$(date +%s)
46
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
47
+ echo "🔴 EVENT 1: Recording START at $(date '+%H:%M:%S')"
48
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
49
+ echo "[EVENT 1] Recording started at $(date '+%H:%M:%S') - TIMESTAMP: $RECORDING_START" >> "$TEMP_FILE"
50
+
51
+ # Verify recording is actually running
52
+ if ps -p $RECORD_PID > /dev/null; then
53
+ echo "✅ Recording started successfully"
54
+ else
55
+ echo "❌ Recording process died, check /tmp/dashcam-recording.log"
56
+ exit 1
57
+ fi
58
+
59
+ # 5. Create synchronized log events with visual markers
60
+ echo ""
61
+ echo "5. Creating synchronized test events..."
62
+ echo ""
63
+ echo "╔════════════════════════════════════════════════════════════════╗"
64
+ echo "║ SYNC TEST - Watch for these markers in the recording! ║"
65
+ echo "╚════════════════════════════════════════════════════════════════╝"
46
66
  echo ""
47
- echo "5. Starting dashcam recording in background..."
48
- ./bin/dashcam.js record --title "Test Workflow Recording" --description "Testing CLI workflow with web and file tracking" &
49
67
 
50
- # Give the recording a moment to initialize
51
- sleep 2
52
- echo "✅ Recording started in background"
68
+ # Event 1 was already written above - now continue with the rest
69
+ sleep 3
53
70
 
54
- # 6. Let recording run for a few seconds
71
+ # Event 2 - after 3 seconds
55
72
  echo ""
56
- echo "6. Letting recording run for 20 seconds..."
57
- sleep 20
58
- echo "✅ Recording completed"
73
+ echo "🟡 EVENT 2: 3 seconds mark at $(date '+%H:%M:%S')"
74
+ echo "[EVENT 2] 3 seconds elapsed at $(date '+%H:%M:%S')" >> "$TEMP_FILE"
75
+ sleep 3
59
76
 
60
- # 7. Stop recording and upload (this will kill the background recording process)
77
+ # Event 3 - after 6 seconds
61
78
  echo ""
62
- echo "7. Stopping recording and uploading..."
79
+ echo "🟢 EVENT 3: 6 seconds mark at $(date '+%H:%M:%S')"
80
+ echo "[EVENT 3] 6 seconds elapsed at $(date '+%H:%M:%S')" >> "$TEMP_FILE"
81
+ sleep 3
82
+
83
+ # Event 4 - after 9 seconds
84
+ echo ""
85
+ echo "🔵 EVENT 4: 9 seconds mark at $(date '+%H:%M:%S')"
86
+ echo "[EVENT 4] 9 seconds elapsed at $(date '+%H:%M:%S')" >> "$TEMP_FILE"
87
+ sleep 3
88
+
89
+ # Event 5 - after 12 seconds
90
+ echo ""
91
+ echo "🟣 EVENT 5: 12 seconds mark at $(date '+%H:%M:%S')"
92
+ echo "[EVENT 5] 12 seconds elapsed at $(date '+%H:%M:%S')" >> "$TEMP_FILE"
93
+ sleep 3
94
+
95
+ # Event 6 - before ending
96
+ echo ""
97
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
98
+ echo "⚫ EVENT 6: Recording END at $(date '+%H:%M:%S')"
99
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
100
+ RECORDING_END=$(date +%s)
101
+ echo "[EVENT 6] Recording ending at $(date '+%H:%M:%S') - TIMESTAMP: $RECORDING_END" >> "$TEMP_FILE"
102
+
103
+ DURATION=$((RECORDING_END - RECORDING_START))
104
+ echo ""
105
+ echo "✅ Test events completed (Duration: ${DURATION}s)"
106
+
107
+ # Give a moment for the last event to be fully processed
108
+ echo ""
109
+ echo "Waiting 2 seconds to ensure all events are captured..."
110
+ sleep 2
111
+
112
+ # 6. Stop recording and upload (this will kill the background recording process)
113
+ echo ""
114
+ echo "6. Stopping recording and uploading..."
63
115
  ./bin/dashcam.js stop
64
116
  echo "✅ Recording stopped and uploaded"
65
117
 
66
- # Cleanup: Stop the background logger
67
118
  echo ""
68
119
  echo "🧹 Cleaning up..."
69
- kill $LOGGER_PID 2>/dev/null || true
70
- echo "✅ Background logger stopped"
71
120
 
72
121
  echo ""
73
122
  echo "🎉 Test workflow completed successfully!"
@@ -78,3 +127,28 @@ echo ""
78
127
  echo "📊 Final Status:"
79
128
  ./bin/dashcam.js status
80
129
 
130
+ echo ""
131
+ echo "╔════════════════════════════════════════════════════════════════╗"
132
+ echo "║ SYNC VERIFICATION GUIDE ║"
133
+ echo "╚════════════════════════════════════════════════════════════════╝"
134
+ echo ""
135
+ echo "To verify video/log synchronization in the recording:"
136
+ echo ""
137
+ echo "1. Open the uploaded recording in your browser"
138
+ echo "2. Check the log panel for '$TEMP_FILE'"
139
+ echo "3. Verify these events appear at the correct times:"
140
+ echo ""
141
+ echo " Time | Terminal Display | Log Entry"
142
+ echo " -------|---------------------------|---------------------------"
143
+ echo " 0:00 | 🔴 EVENT 1 | [EVENT 1] Recording started"
144
+ echo " 0:03 | 🟡 EVENT 2 | [EVENT 2] 3 seconds elapsed"
145
+ echo " 0:06 | 🟢 EVENT 3 | [EVENT 3] 6 seconds elapsed"
146
+ echo " 0:09 | 🔵 EVENT 4 | [EVENT 4] 9 seconds elapsed"
147
+ echo " 0:12 | 🟣 EVENT 5 | [EVENT 5] 12 seconds elapsed"
148
+ echo " 0:15 | ⚫ EVENT 6 | [EVENT 6] Recording ending"
149
+ echo ""
150
+ echo "4. The log timestamps should match the video timeline exactly"
151
+ echo "5. Each colored event marker should appear in the video"
152
+ echo " at the same moment as the corresponding log entry"
153
+ echo ""
154
+
@@ -1,103 +0,0 @@
1
- name: Build Binaries
2
-
3
- on:
4
- workflow_dispatch:
5
- workflow_call:
6
- inputs:
7
- upload_artifacts:
8
- description: 'Whether to upload artifacts'
9
- required: false
10
- type: boolean
11
- default: true
12
-
13
- jobs:
14
- build:
15
- runs-on: ${{ matrix.os }}
16
- strategy:
17
- matrix:
18
- os: [ubuntu-latest, macos-latest, windows-latest]
19
-
20
- steps:
21
- - name: Checkout code
22
- uses: actions/checkout@v4
23
-
24
- - name: Setup Node.js
25
- uses: actions/setup-node@v4
26
- with:
27
- node-version: '20'
28
- cache: 'npm'
29
-
30
- - name: Setup Python (Windows)
31
- if: matrix.os == 'windows-latest'
32
- uses: actions/setup-python@v5
33
- with:
34
- python-version: '3.11'
35
-
36
- - name: Install dependencies
37
- run: npm ci
38
-
39
- - name: Build bundle
40
- run: npm run bundle
41
-
42
- - name: Verify bundle created
43
- run: |
44
- ls -la dist/ || dir dist\
45
- shell: bash
46
-
47
- - name: Build binaries (macOS)
48
- if: matrix.os == 'macos-latest'
49
- run: npm run build:macos
50
-
51
- - name: Build binaries (Linux)
52
- if: matrix.os == 'ubuntu-latest'
53
- run: npm run build:linux
54
-
55
- - name: Build binaries (Windows)
56
- if: matrix.os == 'windows-latest'
57
- run: npm run build:windows
58
- continue-on-error: true
59
-
60
- - name: Check Windows build
61
- if: matrix.os == 'windows-latest'
62
- run: |
63
- if (Test-Path dist/bundle-x64.exe) {
64
- Write-Host "Windows build successful"
65
- exit 0
66
- } else {
67
- Write-Host "Windows build failed, but continuing..."
68
- exit 0
69
- }
70
- shell: pwsh
71
-
72
- - name: List built files
73
- run: |
74
- ls -la dist/ || dir dist\
75
- shell: bash
76
-
77
- - name: Upload artifacts (macOS)
78
- if: matrix.os == 'macos-latest' && (inputs.upload_artifacts || github.event_name == 'pull_request')
79
- uses: actions/upload-artifact@v4
80
- with:
81
- name: dashcam-macos
82
- path: |
83
- dist/bundle-arm64
84
- dist/bundle-x64
85
-
86
- - name: Upload artifacts (Linux)
87
- if: matrix.os == 'ubuntu-latest' && (inputs.upload_artifacts || github.event_name == 'pull_request')
88
- uses: actions/upload-artifact@v4
89
- with:
90
- name: dashcam-linux
91
- path: |
92
- dist/bundle-arm64
93
- dist/bundle-x64
94
-
95
- - name: Upload artifacts (Windows)
96
- if: (matrix.os == 'windows-latest' && hashFiles('dist/bundle-x64.exe') != '') && (inputs.upload_artifacts || github.event_name == 'pull_request')
97
- uses: actions/upload-artifact@v4
98
- with:
99
- name: dashcam-windows
100
- path: |
101
- dist/bundle-x64.exe
102
- dist/bundle-arm64.exe
103
- if-no-files-found: warn
@@ -1,107 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- workflow_dispatch:
5
-
6
- permissions:
7
- contents: write
8
-
9
- jobs:
10
- bump-version:
11
- runs-on: ubuntu-latest
12
- # Skip if commit message contains [skip ci] or [skip release]
13
- if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip release]') }}
14
- outputs:
15
- new_tag: ${{ steps.bump.outputs.new_tag }}
16
- version: ${{ steps.bump.outputs.tag }}
17
- steps:
18
- - name: Checkout code
19
- uses: actions/checkout@v4
20
- with:
21
- fetch-depth: 0
22
- token: ${{ secrets.GITHUB_TOKEN }}
23
-
24
- - name: Bump version and create tag
25
- id: bump
26
- uses: anothrNick/github-tag-action@1.67.0
27
- env:
28
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
- WITH_V: true
30
- DEFAULT_BUMP: patch
31
- INITIAL_VERSION: 1.0.0
32
- RELEASE_BRANCHES: main,master
33
-
34
- build:
35
- needs: bump-version
36
- uses: ./.github/workflows/build.yml
37
- with:
38
- upload_artifacts: true
39
-
40
- release:
41
- needs: [bump-version, build]
42
- runs-on: ubuntu-latest
43
- if: needs.bump-version.outputs.new_tag != ''
44
-
45
- steps:
46
- - name: Download all artifacts
47
- uses: actions/download-artifact@v4
48
- continue-on-error: true
49
-
50
- - name: List downloaded artifacts
51
- run: |
52
- echo "Downloaded artifacts:"
53
- ls -R
54
-
55
- - name: Prepare release files
56
- run: |
57
- mkdir -p release
58
- # macOS binaries
59
- if [ -f dashcam-macos/bundle-arm64 ]; then
60
- cp dashcam-macos/bundle-arm64 release/dashcam-macos-arm64
61
- chmod +x release/dashcam-macos-arm64
62
- fi
63
- if [ -f dashcam-macos/bundle-x64 ]; then
64
- cp dashcam-macos/bundle-x64 release/dashcam-macos-x64
65
- chmod +x release/dashcam-macos-x64
66
- fi
67
- # Linux binaries
68
- if [ -f dashcam-linux/bundle-arm64 ]; then
69
- cp dashcam-linux/bundle-arm64 release/dashcam-linux-arm64
70
- chmod +x release/dashcam-linux-arm64
71
- fi
72
- if [ -f dashcam-linux/bundle-x64 ]; then
73
- cp dashcam-linux/bundle-x64 release/dashcam-linux-x64
74
- chmod +x release/dashcam-linux-x64
75
- fi
76
- # Windows binaries
77
- if [ -f dashcam-windows/bundle-x64.exe ]; then
78
- cp dashcam-windows/bundle-x64.exe release/dashcam-windows-x64.exe
79
- fi
80
- if [ -f dashcam-windows/bundle-arm64.exe ]; then
81
- cp dashcam-windows/bundle-arm64.exe release/dashcam-windows-arm64.exe
82
- fi
83
- ls -la release/
84
-
85
- - name: Create Release
86
- uses: softprops/action-gh-release@v1
87
- with:
88
- tag_name: ${{ needs.bump-version.outputs.new_tag }}
89
- name: Release ${{ needs.bump-version.outputs.new_tag }}
90
- body: |
91
- ## Dashcam CLI Release ${{ needs.bump-version.outputs.new_tag }}
92
-
93
- Automated release with binaries for macOS (x64, ARM64), Linux (x64, ARM64), and Windows (x64, ARM64).
94
-
95
- ### Download Instructions
96
- - **macOS Intel**: `dashcam-macos-x64`
97
- - **macOS Apple Silicon**: `dashcam-macos-arm64`
98
- - **Linux x64**: `dashcam-linux-x64`
99
- - **Linux ARM64**: `dashcam-linux-arm64`
100
- - **Windows x64**: `dashcam-windows-x64.exe`
101
- - **Windows ARM64**: `dashcam-windows-arm64.exe`
102
- files: release/*
103
- draft: false
104
- prerelease: false
105
- fail_on_unmatched_files: false
106
- env:
107
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}