Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

How to connect and stream to a server using MediaRecorder, Socket and ParcelFileDescriptor. Android Studio

$
0
0

on the client side I have this code

Socket socket = new Socket("10.0.0.10", 7800);
                            ParcelFileDescriptor socketWrapper = ParcelFileDescriptor.fromSocket(socket);
                            mediaRecorder = new MediaRecorder();
                            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
                            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
                            mediaRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
                            mediaRecorder.setOutputFile(socketWrapper.getFileDescriptor());
                            mediaRecorder.prepare();
                            mediaRecorder.start();

How do I send this audio to a C ++ server and re-stream it to others using the app?

Server code

// Iniciarlizar winsock
WSADATA wsData;
WORD ver = MAKEWORD(2, 2);

int wsOk = WSAStartup(ver, &wsData);
if (wsOk != 0)
{
    sampgdk::logprintf("Não foi possivel inicializar o winsock! Fechando...!");
    return;
}

// Criar o soquete
SOCKET escutando …

Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>