I am currently writing a program that is a kind of VoIP client. I am trying to establish a connection between two clients and send and receive data recorded from a microphone.
I am currently using files, but it looks like a terrible implementation:
The recorder starts recording to a temporary file. The timer starts, stops the recorder, looks at the file size, and then sends the content using DatagramPacket.
It seems terribly bad. I wonder if the MediaRecorder and MediaPlayer classes have a way to use an UPD socket, as it outputs and enters the file accordingly (i.e. DatagramSocket).
I can use a file descriptor from a socket, but sockets use TCP. I wanted to use UDP, so I think DatagramSocket, but I can’t find a way to use it in my MediaRecorder and MediaPlayer class.
Does anyone have a good solution for this?
Many thanks
source
share