Seeking recommendations for books, tools, software libraries, and more is considered to be off-topic for this site.
As @CommonsWare said, it is off-topic. But learning how to do it from a good example will be fine. So......
https://github.com/hypeapps/Endoscope (626 stars)
License: GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
These are brief points you want to know in this open-source app.
But since it is GNU licensed, if you want to fully use this, you need to make your source code GNU open-source also.
Host
VideoStream.java
/**
* Starts the stream.
* This will also open the camera and display the preview
* if {@link #startPreview()} has not already been called.
*/
public synchronized void start() throws IllegalStateException, IOException {
if (!mPreviewStarted) mCameraOpenedManually = false;
super.start();
Log.d(TAG,"Stream configuration: FPS: "+mQuality.framerate+" Width: "+mQuality.resX+" Height: "+mQuality.resY);
}
RtspServer.java
/* Method PLAY */
else if (request.method.equalsIgnoreCase("PLAY")) {
...
requestAttributes += "url=rtsp://" + mClient.getLocalAddress().getHostAddress() + ":" + mClient.getLocalPort() + "/trackID=" + 0 + ";seq=0,";
...
// If no exception has been thrown, we reply with OK
response.status = Response.STATUS_OK;
}
Client
Play: It uses a media player.
@Override
public void configureMediaPlayer(Uri videoUri) {
...
...
try {
mediaPlayer.setDataSource(this, videoUri);
mediaPlayer.prepareAsync();
} catch (IOException e) {
e.printStackTrace();
}
}