Use SessionBuilder to create a Session object. The Session manages one or more Stream objects. You can use the session asynchronously via callbacks or synchronously using sync methods.
Key Configuration Methods:
setCallback(Session.Callback): Register a callback to handle session events (configured, started, stopped, error, bitrate updates).setSurfaceView(SurfaceView): Required for video streaming to provide a valid surface.setContext(Context): Required to allow streams to store/recover data via SharedPreferences.setAudioEncoder(int): Set audio encoding (e.g., SessionBuilder.AUDIO_NONE, SessionBuilder.AUDIO_AAC).setVideoEncoder(int): Set video encoding (e.g., SessionBuilder.VIDEO_H264).setAudioQuality(AudioQuality) and setVideoQuality(VideoQuality): Configure bitrate and resolution.
Getting the Session Description:
Once the session is configured (after onSessionConfigured() is called), use mSession.getSessionDescription() to get an SDP formatted string. This string can be used by receivers like VLC to connect to the stream.
mSession = SessionBuilder.getInstance()
.setCallback(this)
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90)
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_NONE)
.setAudioQuality(new AudioQuality(16000, 32000))
.setVideoEncoder(SessionBuilder.VIDEO_H264)
.setVideoQuality(new VideoQuality(320,240,20,500000))
.build();
// In onSessionConfigured callback:
String sdp = mSession.getSessionDescription();
mSession.start();