itisnajim / SocketIOUnity

A Wrapper for socket.io-client-csharp to work with Unity.
MIT License
377 stars 64 forks source link

How to send #79

Closed DairexLord1 closed 5 months ago

DairexLord1 commented 6 months ago

How to send audio file from unity to server via socket packed in json file?

itisnajim commented 5 months ago

u can use socketio for signaling then stream via webrtc, i think this is the best way to do https://docs.unity3d.com/Packages/com.unity.webrtc@2.4/manual/audiostreaming.html

for a file, and only socketio the way i'm thinking is to split the file into chunks and send to the server, you can search on how to do that

while ((bytesRead = fileStream.Read(chunkBuffer, 0, chunkSize)) > 0)
{
    // send to the server
    ProcessChunk(chunkBuffer, bytesRead);
}

// Close the file stream when done
fileStream.Close();