In realtime livekit sessions I am able to send a t...
# ask-ai
r
In realtime livekit sessions I am able to send a text message. Is it also possible to send a voice note (like Whatsapp)
t
Thanks for reaching out, Phanos. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you asked! LiveKit is great for real-time audio streaming, so participants can send and receive audio during sessions seamlessly. However, it doesn’t quite work like WhatsApp when it comes to sending voice notes as separate, storable messages. Instead, audio is streamed continuously and isn’t saved for later playback by default. If your goal is to store and retrieve voice messages, you’d want to add some extra features to record, save, and manage those audio files outside of LiveKit’s main setup. I’m here to help if you’d like some guidance on how to make that happen! Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | VoiceAgent/Chat/Send/LocalMessageSender.swift | Building voice agents | LiveKit Docs | plugins/openai/src/realtime/realtime_model.ts
r
I don't need to save it. I just want to send it to the agent. Can i use the Sending files & bytes Use byte streams to send files, images, or any other kind of data between participants. method?
t
Absolutely, you can use LiveKit's byte stream functionality to send voice notes or audio files to other participants in real-time. There are two great options for you to consider: • sendFile: This is perfect if you have a complete audio file saved on your device and want to share it with others. It's straightforward and works well for pre-recorded voice notes. • streamBytes: This method is fantastic for sending audio data bit by bit, which is especially helpful if you want to transmit voice notes live with minimal delay. On the receiving side, participants will just need to set up a byte stream handler to manage the incoming audio data. If you'd like, I’m here to walk you through the detailed steps to get this up and running smoothly! Sources: Realtime data | LiveKit Docs | livekit/src/room/data_stream/outgoing.rs | livekit-rtc/livekit/rtc/data_stream.py | Sending files & bytes | LiveKit docs | Sources/LiveKit/Participant/LocalParticipant+DataStream.swift