Android code for broadcasting live audio from your phone

I am new to android, can someone provide me a code for broadcasting live sound from a microphone phone to media players such as ffmpeg, vlc, etc ... via lan, using Wi-Fi, without using NDK?

[Edit] So far, I have implemented it using the libstreaming library

https://github.com/fyhertz/libstreaming

and it works fine, with the exception of one question, only one player can receive it at a time (since it is unicast). I want to change it to be able to accept more than one player at a time.

My code snippet:

 mSurfaceView = (net.majorkernelpanic.streaming.gl.SurfaceView) findViewById(R.id.surface);

// Sets the port of the RTSP server to 1234
Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
editor.putString(RtspServer.KEY_PORT, String.valueOf(5060));                                                            // audio port num               
editor.commit();

// Configures the SessionBuilde
SessionBuilder.getInstance()
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90)
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setVideoEncoder(SessionBuilder.VIDEO_NONE);


MainActivity.this.startService(new Intent(MainActivity.this,RtspServer.class))
+4
source share

All Articles