diff --git a/package.json b/package.json index b1b6108..bb52c44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "assemblyai", - "version": "4.25.0", + "version": "4.25.1", "description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.", "engines": { "node": ">=18" diff --git a/src/services/streaming/service.ts b/src/services/streaming/service.ts index 0955a52..8012915 100644 --- a/src/services/streaming/service.ts +++ b/src/services/streaming/service.ts @@ -246,6 +246,10 @@ Learn more at https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/docs/c this.listeners.turn?.(message); break; } + case "SpeechStarted": { + this.listeners.speechStarted?.(message); + break; + } case "Termination": { this.sessionTerminatedResolve?.(); break; diff --git a/src/types/streaming/index.ts b/src/types/streaming/index.ts index d37f59b..953ef28 100644 --- a/src/types/streaming/index.ts +++ b/src/types/streaming/index.ts @@ -26,12 +26,18 @@ export type StreamingTranscriberParams = { maxSpeakers?: number; }; -export type StreamingEvents = "open" | "close" | "turn" | "error"; +export type StreamingEvents = + | "open" + | "close" + | "turn" + | "speechStarted" + | "error"; export type StreamingListeners = { open?: (event: BeginEvent) => void; close?: (code: number, reason: string) => void; turn?: (event: TurnEvent) => void; + speechStarted?: (event: SpeechStartedEvent) => void; error?: (error: Error) => void; }; @@ -59,6 +65,11 @@ export type BeginEvent = { expires_at: number; }; +export type SpeechStartedEvent = { + type: "SpeechStarted"; + timestamp: number; +}; + export type TurnEvent = { type: "Turn"; turn_order: number; @@ -117,6 +128,7 @@ export type ErrorEvent = { export type StreamingEventMessage = | BeginEvent | TurnEvent + | SpeechStartedEvent | TerminationEvent | ErrorEvent;