billowy-analyst-47555
08/06/2025, 6:34 PMtall-airline-16756
08/06/2025, 6:34 PMtall-airline-16756
08/06/2025, 6:35 PMLocalParticipant class:
Sending Files
Use the sendFile method:tall-airline-16756
08/06/2025, 6:37 PMSendFileOptions or StreamBytesOptions?
• Wondering how to handle the files or streams once they’re received?
• Looking for extra examples or some troubleshooting tips for these methods?
Feel free to tell me more about what you’re working on, and I’ll be happy to help out!tall-airline-16756
08/06/2025, 6:39 PMsendFile method like this in Flutter:
var info = await room.localParticipant.sendFile(
File('path_to_your_file'),
options: SendFileOptions(
topic: 'files',
onProgress: (progress) {
print('Progress: $progress');
},
),
);
2. Verify the Python Backend Handler
• Confirm your Python backend has a handler set up for the "files" topic:
async def on_file_received(reader, participant_identity):
logger.info("Received file from %s: '%s'", participant_identity, reader.info.name)
with open(reader.info.name, mode="wb") as f:
async for chunk in reader:
f.write(chunk)
• Don’t forget to register the handler before connecting to the room:
room.set_byte_stream_handler("files", on_file_received)
3. A Few Friendly Debugging Tips
• Make sure the topic matches exactly on both the sender and receiver sides.
• Check that MIME types are detected correctly and your file permissions allow reading and writing.
• Handle all chunks properly on the receiver side and close streams when done.
If you hit any snags or want me to walk you through more detailed debugging, just let me know—I’m here to help!