Class: SpeakerStream

SpeakerStream

new SpeakerStream(options)

Object-Mode stream that splits up results by speaker.

Output format is similar to existing results formats, but with an extra speaker field,

Output results array will usually contain multiple results. All results are interim until the final batch; the text may change (if options.speakerlessInterim is enabled) or move from one interim result to another.

Keywords, words_alternatives, and other features may appear on results that come slightly earlier than the timestamp due to the way things are split up.

Ignores interim results from the service unless options.speakerlessInterim is enabled.

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
speakerlessInterim boolean <optional>
false

emit interim results before initial speaker has been identified (allows UI to update more quickly)

Source:

Methods

buildMessage() → {*}

Builds a results object with everything we've got so far

Source:
Returns:
Type
*

handleResults(data)

Captures the timestamps out of results or errors if timestamps are missing

Parameters:
Name Type Description
data Object
Source:

Events

data

Emit an object similar to the normal results object, only with multiple entries in the results Array (a new one each time the speaker changes), and with a speaker field on the results.

result_index is always 0 because the results always includes the entire conversation so far.

Parameters:
Name Type Description
results-format Object

message with multiple results and an extra speaker field on each result

Source: