Am I using Text to Speech or Universal streaming with the current implementation?
Dear AssemblyAI team,
I have inherited a live transcription piece of code from a previous developer. I have been reading the changelog where Universal-Streaming was introduced.
I am using "assemblyai": "4.9.0" in my frontend code, and I need to know if this one is using Universal Streaming or not?
The official documentation seems to be a code running in backend environment:
https://www.assemblyai.com/docs/speech-to-text/universal-streaming
My questions would be:
- Is my implementation using Universal Streaming or not? (I can't really figure it out from the types or from the documentation)
- Does updating my assemblyai package for 4.13.3 will make it use Universal Streaming? Or would it give an option for that?
Thank You in advance, Just a confused silly dev.
My code:
"use client";
import { useRef, useState, useEffect, useCallback } from "react";
import {
RecordRTCPromisesHandler as RecordRTC,
StereoAudioRecorder,
} from "recordrtc";
import { RealtimeTranscriber } from "assemblyai";
const initTranscriber = async () => {
// Don't initialize if we're already initializing or have an instance
if (
isTranscriberConnecting.current ||
isTranscriberConnected.current ||
realtimeTranscriber.current
) {
return;
}
isTranscriberConnecting.current = true;
try {
const token = await getToken();
realtimeTranscriber.current = new RealtimeTranscriber({
token,
sampleRate: 16000,
});
.... REST OF THE CODE
I think the docs could be so much clearer, but according to the guide here you need to connect to an v3 endpoint but the source code for RealtimeTranscriber says:
const defaultRealtimeUrl = "wss://api.assemblyai.com/v2/realtime/ws";
Whereas the source for StreamingTranscriber says:
const defaultStreamingUrl = "wss://streaming.assemblyai.com/v3/ws";
Is there any update on this?