Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to play SSE from api in next js ? #33

Open
HrideyReact opened this issue Dec 27, 2024 · 1 comment
Open

How to play SSE from api in next js ? #33

HrideyReact opened this issue Dec 27, 2024 · 1 comment

Comments

@HrideyReact
Copy link

Screenshot 2024-12-27 at 10 07 12 AM I am receving stream from the api in raw format and encoding pcm_f32le, I have to use ffmpeg on server to convert it to mpeg format and then stream it to client.

But when playing on client it does not play correctly, it is missing audio parts between the audio, I am using AudioContext to stream the audio.. Any way to stream it correctly from server to client ?

Also the chunks received from API contains audio data inside data ? It's difficult to get audio data from it
I get event:chunk data:{type:chunk, data:"Adgewssds" } something like this

@fern-support
Copy link
Collaborator

@HrideyReact can you use the client.tts.sse method in the SDK (it looks like you are using custom fetch calls). https://github.com/cartesia-ai/cartesia-js/blob/main/reference.md is an example of how to call the endpoint

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

No branches or pull requests

2 participants