Skip to content

Add features for caption exports, speaker segments, and session telemetry - #23

Merged
itsRares merged 1 commit into
mainfrom
feature/2.4.0
Jul 13, 2026
Merged

itsRares merged 1 commit into
mainfrom
feature/2.4.0

Conversation

@itsRares

Copy link
Copy Markdown
Owner

Introduce new caption export helpers for converting transcription responses into SubRip and WebVTT formats. Add functionality for creating speaker-attributed transcripts from diarized responses. Implement session telemetry with an opt-in tracking feature for real-time statistics. Enhance voice agent capabilities with a barge-in feature for improved user interaction. All additions maintain backward compatibility.

### Added

- **Caption export helpers.** New `toSRT()` and `toWebVTT()` exports that
  convert a Deepgram pre-recorded transcription response (word timings, or
  utterances when `utterances=true`) into SubRip / WebVTT subtitle text.
  Cue segmentation is tunable via `CaptionOptions` (`lineLength`, `lineCount`,
  `speakerLabels` for diarized `Speaker N:` prefixes). Pure functions — no
  network or native calls.
- **Speaker-attributed transcripts.** New `toSpeakerSegments()` export that
  folds a diarized (`diarize=true`) response into ordered
  `SpeakerSegment { speaker, text, start, end, confidence }` chunks, merging
  consecutive words from the same speaker. Returns `[]` for non-diarized
  responses instead of throwing.
- **Session telemetry.** `useDeepgramSpeechToText` and `useDeepgramVoiceAgent`
  now expose a `getStats()` method returning a `SessionStats` snapshot
  (`bytesSent`, `bytesReceived`, `framesDropped`, `reconnects`,
  `connectedAtMs`, `firstResultMs`). An opt-in `trackStats` prop additionally
  enables a reactive `stats` return value, throttled to at most one update per
  second so it never floods renders.
- **Voice Agent barge-in.** Opt-in `bargeIn` prop on `useDeepgramVoiceAgent`
  flushes the native playback queue when the server reports
  `UserStartedSpeaking` while agent audio is playing, so the agent audibly
  stops when the user talks over it. Fires the new `onBargeIn` callback only
  when a flush actually happened; never flushes while muted, and the streaming
  player resumes seamlessly on the agent's next turn. Reliable barge-in
  depends on hardware echo cancellation — test on a physical device.
@itsRares
itsRares merged commit 6c87365 into main Jul 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant