yaver-feedback-react-native 0.6.1 → 0.7.1

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.
@@ -72,7 +72,12 @@ export const YaverMachinePickerScreen: React.FC<YaverMachinePickerProps> = ({
72
72
 
73
73
  const renderDevice = (device: RemoteDevice) => {
74
74
  const selected = device.deviceId === currentDeviceId;
75
- const stale = Date.now() - device.lastHeartbeat > 60_000;
75
+ // Match the Yaver mobile app: HEARTBEAT_STALE_MS is 90 s. Using
76
+ // 60 s here flashed yellow on a single missed agent beat even
77
+ // though the Mac was up.
78
+ const stale =
79
+ device.lastHeartbeat > 0 &&
80
+ Date.now() - device.lastHeartbeat > 90_000;
76
81
  const healthColor = !device.isOnline
77
82
  ? '#ef4444'
78
83
  : device.needsAuth || device.runnerDown || stale
package/src/P2PClient.ts CHANGED
@@ -79,14 +79,6 @@ export class P2PClient {
79
79
  } as any);
80
80
  }
81
81
 
82
- if (bundle.audio) {
83
- formData.append('audio', {
84
- uri: Platform.OS === 'android' ? `file://${bundle.audio}` : bundle.audio,
85
- type: 'audio/m4a',
86
- name: 'voice_note.m4a',
87
- } as any);
88
- }
89
-
90
82
  if (bundle.video) {
91
83
  formData.append('video', {
92
84
  uri: Platform.OS === 'android' ? `file://${bundle.video}` : bundle.video,
@@ -223,20 +215,82 @@ export class P2PClient {
223
215
  * @param mode - "dev" for hot reload, "bundle" for native bundle rebuild
224
216
  */
225
217
  async reloadApp(mode: 'dev' | 'bundle' = 'dev'): Promise<{ ok: boolean }> {
226
- const response = await fetch(`${this.baseUrl}/dev/reload-app`, {
218
+ // Primary path: /dev/reload — same endpoint the Yaver mobile app uses.
219
+ // Triggers Metro/Expo HMR synchronously and emits an SSE `reload` event
220
+ // on /dev/events that the FeedbackModal can subscribe to for progress.
221
+ //
222
+ // Only fall back to /dev/reload-app (the BlackBox-SSE-broadcast path)
223
+ // when the primary path reports "no dev server running" — that mode is
224
+ // really for the mobile app remotely kicking a third-party app, not
225
+ // for the app kicking itself.
226
+ const primary = await fetch(`${this.baseUrl}/dev/reload`, {
227
+ method: 'POST',
228
+ headers: { Authorization: `Bearer ${this.authToken}` },
229
+ });
230
+ if (primary.ok) {
231
+ return primary.json().catch(() => ({ ok: true }));
232
+ }
233
+ if (primary.status >= 500 || primary.status === 404 || mode === 'bundle') {
234
+ const fallback = await fetch(`${this.baseUrl}/dev/reload-app`, {
235
+ method: 'POST',
236
+ headers: {
237
+ Authorization: `Bearer ${this.authToken}`,
238
+ 'Content-Type': 'application/json',
239
+ },
240
+ body: JSON.stringify({ mode }),
241
+ });
242
+ if (!fallback.ok) {
243
+ const text = await fallback.text().catch(() => '');
244
+ throw new Error(`[P2PClient] Reload failed (${fallback.status}): ${text}`);
245
+ }
246
+ return fallback.json().catch(() => ({ ok: true }));
247
+ }
248
+ const text = await primary.text().catch(() => '');
249
+ throw new Error(`[P2PClient] Reload failed (${primary.status}): ${text}`);
250
+ }
251
+
252
+ /**
253
+ * Open a vibing session on the connected agent. Vibing is the Yaver
254
+ * interactive coding-agent flow — `/vibing/execute` creates a task with
255
+ * the project context plus the user's prompt. Returns the task id the
256
+ * caller can poll via `/tasks/{id}` if needed.
257
+ *
258
+ * Requires an owner/CLI/paired token — the `/vibing*` routes do not
259
+ * currently accept SDK-minted tokens. Power users typically drive
260
+ * vibing from Claude Code / the Yaver mobile app; this method is a
261
+ * convenience for the SDK's one-tap bug-report-to-vibing path.
262
+ */
263
+ async vibing(prompt: string, projectPath?: string): Promise<{ taskId: string }> {
264
+ const response = await fetch(`${this.baseUrl}/vibing/execute`, {
227
265
  method: 'POST',
228
266
  headers: {
229
267
  Authorization: `Bearer ${this.authToken}`,
230
268
  'Content-Type': 'application/json',
231
269
  },
232
- body: JSON.stringify({ mode }),
270
+ body: JSON.stringify({ prompt, projectPath: projectPath ?? '' }),
233
271
  });
234
-
235
272
  if (!response.ok) {
236
273
  const text = await response.text().catch(() => '');
237
- throw new Error(`[P2PClient] Reload app failed (${response.status}): ${text}`);
274
+ throw new Error(`[P2PClient] Vibing failed (${response.status}): ${text}`);
238
275
  }
276
+ return response.json();
277
+ }
239
278
 
279
+ /**
280
+ * After uploading a feedback bundle with `uploadFeedback`, call this
281
+ * with the returned report id to create a fix task on the agent. The
282
+ * task includes the feedback's screenshots, errors, and (when available)
283
+ * the BlackBox context for the originating device.
284
+ */
285
+ async triggerFix(feedbackId: string): Promise<{ taskId: string; prompt: string }> {
286
+ const response = await fetch(`${this.baseUrl}/feedback/${encodeURIComponent(feedbackId)}/fix`, {
287
+ method: 'POST',
288
+ headers: { Authorization: `Bearer ${this.authToken}` },
289
+ });
290
+ if (!response.ok) {
291
+ const text = await response.text().catch(() => '');
292
+ throw new Error(`[P2PClient] Fix trigger failed (${response.status}): ${text}`);
293
+ }
240
294
  return response.json();
241
295
  }
242
296
 
@@ -77,8 +77,6 @@ export class YaverFeedback {
77
77
  config = {
78
78
  trigger: 'shake',
79
79
  maxRecordingDuration: 120,
80
- feedbackMode: 'batch',
81
- agentCommentaryLevel: 0,
82
80
  autoLogin: true,
83
81
  ...cfg,
84
82
  };
@@ -203,6 +201,33 @@ export class YaverFeedback {
203
201
  }
204
202
  }
205
203
 
204
+ /**
205
+ * Force a fresh Convex lookup for the agent URL — ignoring any
206
+ * cached URL. Callers use this after a P2P request fails
207
+ * (connection refused / timeout) because the most common cause is
208
+ * the Mac's LAN IP rotating. Convex has the fresh one, so we
209
+ * re-query and probe `[quicHost, ...localIps]` in parallel.
210
+ *
211
+ * Returns true when a new URL was adopted.
212
+ */
213
+ static async reconnect(): Promise<boolean> {
214
+ if (!config || !enabled) return false;
215
+ if (!config.authToken || !config.convexUrl) return false;
216
+ try {
217
+ const result = await YaverDiscovery.refreshFromConvex({
218
+ convexUrl: config.convexUrl,
219
+ authToken: config.authToken,
220
+ preferredDeviceId: config.preferredDeviceId,
221
+ });
222
+ if (!result) return false;
223
+ config.agentUrl = result.url;
224
+ p2pClient = new P2PClient(result.url, config.authToken ?? '');
225
+ return true;
226
+ } catch {
227
+ return false;
228
+ }
229
+ }
230
+
206
231
  /**
207
232
  * Pull a cached session token + selected device from AsyncStorage (populated
208
233
  * by the in-SDK login + machine-picker screens). When present the SDK can
@@ -488,16 +513,6 @@ export class YaverFeedback {
488
513
  return p2pClient;
489
514
  }
490
515
 
491
- /** Returns the current feedback mode. */
492
- static getFeedbackMode(): 'live' | 'narrated' | 'batch' {
493
- return config?.feedbackMode ?? 'batch';
494
- }
495
-
496
- /** Returns the agent commentary level (0-10). */
497
- static getCommentaryLevel(): number {
498
- return config?.agentCommentaryLevel ?? 0;
499
- }
500
-
501
516
  // ─── One-stop SaaS replacement methods ─────────────────────────
502
517
  //
503
518
  // These are the three solo-dev SaaS-replacement entry points
@@ -39,8 +39,6 @@ describe('YaverFeedback', () => {
39
39
  expect(cfg!.agentUrl).toBe('http://localhost:18080');
40
40
  expect(cfg!.trigger).toBe('shake');
41
41
  expect(cfg!.maxRecordingDuration).toBe(120);
42
- expect(cfg!.feedbackMode).toBe('batch');
43
- expect(cfg!.agentCommentaryLevel).toBe(0);
44
42
  });
45
43
 
46
44
  it('respects user-provided values over defaults', () => {
@@ -48,15 +46,13 @@ describe('YaverFeedback', () => {
48
46
  authToken: 'tok',
49
47
  trigger: 'floating-button',
50
48
  maxRecordingDuration: 60,
51
- feedbackMode: 'live',
52
- agentCommentaryLevel: 7,
49
+ strictNativeAuth: true,
53
50
  });
54
51
 
55
52
  const cfg = YaverFeedback.getConfig();
56
53
  expect(cfg!.trigger).toBe('floating-button');
57
54
  expect(cfg!.maxRecordingDuration).toBe(60);
58
- expect(cfg!.feedbackMode).toBe('live');
59
- expect(cfg!.agentCommentaryLevel).toBe(7);
55
+ expect(cfg!.strictNativeAuth).toBe(true);
60
56
  });
61
57
 
62
58
  it('with enabled=false sets enabled to false', () => {
@@ -130,41 +126,6 @@ describe('YaverFeedback', () => {
130
126
  });
131
127
  });
132
128
 
133
- describe('getFeedbackMode()', () => {
134
- it('defaults to batch when no config', () => {
135
- // After any init, feedbackMode defaults to 'batch'
136
- YaverFeedback.init({ authToken: 'tok' });
137
- expect(YaverFeedback.getFeedbackMode()).toBe('batch');
138
- });
139
-
140
- it('returns configured mode', () => {
141
- YaverFeedback.init({ authToken: 'tok', feedbackMode: 'narrated' });
142
- expect(YaverFeedback.getFeedbackMode()).toBe('narrated');
143
- });
144
-
145
- it('returns live when configured', () => {
146
- YaverFeedback.init({ authToken: 'tok', feedbackMode: 'live' });
147
- expect(YaverFeedback.getFeedbackMode()).toBe('live');
148
- });
149
- });
150
-
151
- describe('getCommentaryLevel()', () => {
152
- it('defaults to 0', () => {
153
- YaverFeedback.init({ authToken: 'tok' });
154
- expect(YaverFeedback.getCommentaryLevel()).toBe(0);
155
- });
156
-
157
- it('returns configured level', () => {
158
- YaverFeedback.init({ authToken: 'tok', agentCommentaryLevel: 5 });
159
- expect(YaverFeedback.getCommentaryLevel()).toBe(5);
160
- });
161
-
162
- it('returns max level when set to 10', () => {
163
- YaverFeedback.init({ authToken: 'tok', agentCommentaryLevel: 10 });
164
- expect(YaverFeedback.getCommentaryLevel()).toBe(10);
165
- });
166
- });
167
-
168
129
  describe('startReport()', () => {
169
130
  it('does nothing when not enabled', async () => {
170
131
  YaverFeedback.init({ authToken: 'tok', enabled: false });
@@ -6,7 +6,6 @@ import type {
6
6
  DeviceInfo,
7
7
  AppInfo,
8
8
  FeedbackReport,
9
- AgentCommentary,
10
9
  FeedbackStreamEvent,
11
10
  } from '../types';
12
11
 
@@ -21,8 +20,6 @@ describe('React Native SDK types', () => {
21
20
  expect(config.trigger).toBeUndefined();
22
21
  expect(config.enabled).toBeUndefined();
23
22
  expect(config.maxRecordingDuration).toBeUndefined();
24
- expect(config.feedbackMode).toBeUndefined();
25
- expect(config.agentCommentaryLevel).toBeUndefined();
26
23
  });
27
24
 
28
25
  it('can be constructed with all optional fields', () => {
@@ -32,12 +29,10 @@ describe('React Native SDK types', () => {
32
29
  trigger: 'shake',
33
30
  enabled: true,
34
31
  maxRecordingDuration: 60,
35
- feedbackMode: 'live',
36
- agentCommentaryLevel: 7,
32
+ strictNativeAuth: true,
37
33
  };
38
34
  expect(config.trigger).toBe('shake');
39
- expect(config.feedbackMode).toBe('live');
40
- expect(config.agentCommentaryLevel).toBe(7);
35
+ expect(config.strictNativeAuth).toBe(true);
41
36
  });
42
37
 
43
38
  it('accepts all trigger types', () => {
@@ -47,14 +42,6 @@ describe('React Native SDK types', () => {
47
42
  expect(config.trigger).toBe(trigger);
48
43
  });
49
44
  });
50
-
51
- it('accepts all feedback modes', () => {
52
- const modes: FeedbackConfig['feedbackMode'][] = ['live', 'narrated', 'batch'];
53
- modes.forEach((mode) => {
54
- const config: FeedbackConfig = { authToken: 'tok', feedbackMode: mode };
55
- expect(config.feedbackMode).toBe(mode);
56
- });
57
- });
58
45
  });
59
46
 
60
47
  describe('FeedbackBundle', () => {
@@ -82,10 +69,9 @@ describe('React Native SDK types', () => {
82
69
  expect(bundle.metadata.device.platform).toBe('ios');
83
70
  expect(bundle.screenshots).toEqual([]);
84
71
  expect(bundle.video).toBeUndefined();
85
- expect(bundle.audio).toBeUndefined();
86
72
  });
87
73
 
88
- it('can include optional video, audio, and screenshots', () => {
74
+ it('can include optional video + screenshots', () => {
89
75
  const bundle: FeedbackBundle = {
90
76
  metadata: {
91
77
  timestamp: '2026-03-24T12:00:00Z',
@@ -100,12 +86,10 @@ describe('React Native SDK types', () => {
100
86
  userNote: 'This button does not work',
101
87
  },
102
88
  video: '/tmp/recording.mp4',
103
- audio: '/tmp/voice.m4a',
104
89
  screenshots: ['/tmp/ss1.png', '/tmp/ss2.png'],
105
90
  };
106
91
 
107
92
  expect(bundle.video).toBe('/tmp/recording.mp4');
108
- expect(bundle.audio).toBe('/tmp/voice.m4a');
109
93
  expect(bundle.screenshots).toHaveLength(2);
110
94
  expect(bundle.metadata.userNote).toBe('This button does not work');
111
95
  });
@@ -213,26 +197,6 @@ describe('React Native SDK types', () => {
213
197
  });
214
198
  });
215
199
 
216
- describe('AgentCommentary', () => {
217
- it('has correct structure', () => {
218
- const commentary: AgentCommentary = {
219
- id: 'cmt-1',
220
- timestamp: '2026-03-24T12:00:00Z',
221
- message: 'I see a layout issue on the login screen',
222
- type: 'observation',
223
- };
224
- expect(commentary.type).toBe('observation');
225
- });
226
-
227
- it('accepts all commentary types', () => {
228
- const types: AgentCommentary['type'][] = ['observation', 'suggestion', 'question', 'action'];
229
- types.forEach((type) => {
230
- const c: AgentCommentary = { id: '1', timestamp: 'now', message: 'test', type };
231
- expect(c.type).toBe(type);
232
- });
233
- });
234
- });
235
-
236
200
  describe('FeedbackStreamEvent', () => {
237
201
  it('has correct structure', () => {
238
202
  const event: FeedbackStreamEvent = {
package/src/auth.ts CHANGED
@@ -409,7 +409,17 @@ export interface RemoteDevice {
409
409
  accessScope: 'owner' | 'shared-scoped' | 'shared-legacy';
410
410
  quicHost: string;
411
411
  quicPort: number;
412
+ /** Agent HTTP port — preferred over quicPort when present. */
413
+ httpPort?: number;
412
414
  publicKey?: string;
415
+ /** Hardware identifier — used for dedup across re-pair events. */
416
+ hwid?: string;
417
+ /**
418
+ * Every LAN IP the agent reported in its last heartbeat. Useful on
419
+ * multi-homed hosts — probing all of them in parallel is the same
420
+ * trick the Yaver mobile app uses to "just work" on the same Wi-Fi.
421
+ */
422
+ localIps?: string[];
413
423
  }
414
424
 
415
425
  export interface DeviceList {
@@ -420,6 +430,10 @@ export interface DeviceList {
420
430
  /**
421
431
  * Fetch the set of remote dev machines this user can reach. Splits into
422
432
  * owned (user is the host) vs shared (host invited them as a guest).
433
+ *
434
+ * Collapses duplicate rows before splitting — Convex can return multiple
435
+ * rows per physical machine after a re-pair or hostname change, and the
436
+ * raw list used to render as "Kvancs-MacBook-Air.local ×3" in the picker.
423
437
  */
424
438
  export async function listReachableDevices(
425
439
  token: string,
@@ -430,10 +444,39 @@ export async function listReachableDevices(
430
444
  });
431
445
  if (!res.ok) return { owned: [], shared: [] };
432
446
  const data = await res.json();
433
- const all = (data.devices ?? []) as RemoteDevice[];
447
+ const raw = (data.devices ?? []) as any[];
448
+ // Normalise Convex field names → SDK's RemoteDevice shape. The
449
+ // backend returns `localIps`, sometimes the mobile-side mapping
450
+ // surfaces `lanIps` — accept either so the field survives.
451
+ const normalised: RemoteDevice[] = raw.map((d) => ({
452
+ deviceId: d.deviceId ?? d.id,
453
+ name: d.name ?? '',
454
+ platform: d.platform ?? d.os ?? '',
455
+ isOnline: !!d.isOnline,
456
+ needsAuth: !!d.needsAuth,
457
+ runnerDown: !!d.runnerDown,
458
+ lastHeartbeat: d.lastHeartbeat ?? 0,
459
+ isGuest: !!d.isGuest,
460
+ hostName: d.hostName,
461
+ hostEmail: d.hostEmail,
462
+ accessScope: d.accessScope ?? 'owner',
463
+ quicHost: d.quicHost ?? d.host ?? '',
464
+ quicPort: d.quicPort ?? 0,
465
+ httpPort: d.httpPort ?? d.quicPort,
466
+ publicKey: d.publicKey,
467
+ hwid: d.hardwareId ?? d.hwid,
468
+ localIps: Array.isArray(d.localIps)
469
+ ? d.localIps
470
+ : Array.isArray(d.lanIps)
471
+ ? d.lanIps
472
+ : undefined,
473
+ }));
474
+ // Lazy require so Jest + tree-shakers don't choke on a circular import.
475
+ const { collapseRemoteDevices } = require('./deviceDedup') as typeof import('./deviceDedup');
476
+ const deduped = collapseRemoteDevices(normalised);
434
477
  return {
435
- owned: all.filter((d) => !d.isGuest),
436
- shared: all.filter((d) => d.isGuest),
478
+ owned: deduped.filter((d) => !d.isGuest),
479
+ shared: deduped.filter((d) => d.isGuest),
437
480
  };
438
481
  } catch {
439
482
  return { owned: [], shared: [] };
package/src/capture.ts CHANGED
@@ -1,18 +1,24 @@
1
1
  /**
2
- * Screen capture and audio recording helpers.
2
+ * Screen capture helpers screenshot + video recording.
3
3
  *
4
- * Screenshot capture requires `react-native-view-shot` as a peer dependency.
5
- * Audio recording requires `react-native-audio-recorder-player` or a
6
- * similar library the implementation below uses a minimal approach
7
- * that works when one of those is available.
4
+ * Peer deps (all optional loaded lazily):
5
+ * - `react-native-view-shot` screenshot
6
+ * - `react-native-record-screen` video recording (iOS ReplayKit /
7
+ * Android MediaProjection)
8
+ *
9
+ * Each helper surfaces a clear error if the module is missing so a host
10
+ * app knows exactly which peer dep to add. Audio-note / voice-command
11
+ * recording was removed in 0.7.0 — see FeedbackModal for the new
12
+ * 5-button surface.
8
13
  */
9
14
 
10
- let audioRecorderModule: any = null;
11
-
12
15
  /**
13
16
  * Capture the current screen as a PNG image.
14
17
  * Requires `react-native-view-shot` to be installed.
15
- * @returns File path of the captured screenshot.
18
+ *
19
+ * Note: the feedback modal should hide itself *before* calling this so the
20
+ * screenshot contains the underlying app state (the actual bug), not the
21
+ * modal. See `FeedbackModal.handleScreenshotForFix`.
16
22
  */
17
23
  export async function captureScreenshot(): Promise<string> {
18
24
  try {
@@ -24,61 +30,91 @@ export async function captureScreenshot(): Promise<string> {
24
30
  return uri;
25
31
  } catch (err) {
26
32
  throw new Error(
27
- '[YaverFeedback] Screenshot capture failed. Make sure react-native-view-shot is installed. ' +
33
+ '[YaverFeedback] Screenshot capture failed. Install react-native-view-shot as a peer dep. ' +
28
34
  String(err),
29
35
  );
30
36
  }
31
37
  }
32
38
 
39
+ let videoRecorderModule: any = null;
40
+ let videoRecordingActive = false;
41
+
33
42
  /**
34
- * Start recording an audio voice note.
35
- * Requires `react-native-audio-recorder-player` to be installed.
43
+ * Start a screen-recording session. Requires
44
+ * `react-native-record-screen` as a peer dep.
45
+ *
46
+ * The user must grant the iOS ReplayKit / Android MediaProjection
47
+ * permission the first time; the prompt is shown by the native module,
48
+ * not the SDK.
36
49
  */
37
- export async function startAudioRecording(): Promise<void> {
50
+ export async function startVideoRecording(): Promise<void> {
51
+ if (videoRecordingActive) {
52
+ throw new Error('[YaverFeedback] A video recording is already in progress.');
53
+ }
38
54
  try {
39
- const AudioRecorderPlayer =
40
- require('react-native-audio-recorder-player').default;
41
- audioRecorderModule = new AudioRecorderPlayer();
42
- await audioRecorderModule.startRecorder();
55
+ videoRecorderModule = require('react-native-record-screen').default ??
56
+ require('react-native-record-screen');
57
+ if (typeof videoRecorderModule.startRecording !== 'function') {
58
+ throw new Error('react-native-record-screen missing startRecording()');
59
+ }
60
+ const result = await videoRecorderModule.startRecording({
61
+ mic: false,
62
+ width: 720,
63
+ bitrate: 1024 * 1000,
64
+ });
65
+ if (result && result.status && result.status !== 'success') {
66
+ throw new Error(`startRecording returned ${result.status}`);
67
+ }
68
+ videoRecordingActive = true;
43
69
  } catch (err) {
44
- audioRecorderModule = null;
70
+ videoRecorderModule = null;
71
+ videoRecordingActive = false;
45
72
  throw new Error(
46
- '[YaverFeedback] Audio recording failed to start. Make sure react-native-audio-recorder-player is installed. ' +
73
+ '[YaverFeedback] Could not start screen recording. Install react-native-record-screen. ' +
47
74
  String(err),
48
75
  );
49
76
  }
50
77
  }
51
78
 
52
79
  /**
53
- * Stop the current audio recording.
54
- * @returns Object with the file path and duration in seconds.
80
+ * Stop the current video recording and return the on-device file path.
55
81
  */
56
- export async function stopAudioRecording(): Promise<{
82
+ export async function stopVideoRecording(): Promise<{
57
83
  path: string;
58
84
  duration: number;
59
85
  }> {
60
- if (!audioRecorderModule) {
61
- throw new Error('[YaverFeedback] No audio recording in progress.');
86
+ if (!videoRecordingActive || !videoRecorderModule) {
87
+ throw new Error('[YaverFeedback] No video recording in progress.');
62
88
  }
63
-
64
89
  try {
65
- const result = await audioRecorderModule.stopRecorder();
66
- const recorder = audioRecorderModule;
67
- audioRecorderModule = null;
68
-
69
- // result is the file path on most implementations
70
- const path = typeof result === 'string' ? result : result?.uri ?? '';
71
- // Duration tracking — recorder-player provides currentPosition in ms
90
+ const res = await videoRecorderModule.stopRecording();
91
+ videoRecordingActive = false;
92
+ const path =
93
+ typeof res === 'string'
94
+ ? res
95
+ : (res?.result?.outputURL as string) ??
96
+ (res?.outputURL as string) ??
97
+ (res?.uri as string) ??
98
+ '';
72
99
  const durationMs =
73
- typeof recorder.currentPosition === 'number'
74
- ? recorder.currentPosition
75
- : 0;
76
-
100
+ typeof res?.result?.duration === 'number'
101
+ ? res.result.duration
102
+ : typeof res?.duration === 'number'
103
+ ? res.duration
104
+ : 0;
105
+ if (!path) {
106
+ throw new Error('stopRecording() returned no file path');
107
+ }
77
108
  return { path, duration: durationMs / 1000 };
78
109
  } catch (err) {
79
- audioRecorderModule = null;
110
+ videoRecordingActive = false;
80
111
  throw new Error(
81
- '[YaverFeedback] Failed to stop audio recording. ' + String(err),
112
+ '[YaverFeedback] Failed to stop screen recording. ' + String(err),
82
113
  );
83
114
  }
84
115
  }
116
+
117
+ /** Whether a video recording is currently active. */
118
+ export function isVideoRecording(): boolean {
119
+ return videoRecordingActive;
120
+ }