pedroSG94 / RTSP-Server

Plugin of rtmp-rtsp-stream-client-java to stream directly to RTSP player.
Apache License 2.0
211 stars 65 forks source link

Streaming from WIFI Camera #123

Open mariomoureperez opened 3 months ago

mariomoureperez commented 3 months ago

Hello, I currently have a WIFI camera that I connect to my app and display its content on a SurfaceView.

Is there any way to create an RTSP server to stream the content of the SurfaceView instead of the camera's feed?

App Purpose: Any device on the same network as the smartphone should be able to view what is displayed on my SurfaceView via rtsp://ip-smartphone/

Thanks

pedroSG94 commented 3 months ago

Hello,

Yes, this is possible but no directly your SurfaceView. You need use RtspServerStream class, create a new VideoSource and bind your library used to render that SurfaceView in the VideoSource.

To do it I recommend you read this related posts (the concept is the same but instead of use an external usb camera library you are using a library that get the stream from a rtsp ip): https://github.com/pedroSG94/RTSP-Server/issues/121 https://github.com/pedroSG94/RTSP-Server/issues/110

If you need more help I will need know the way you connect that rtsp stream with your SurfaceView

mariomoureperez commented 3 months ago

Thank you for the quick response,

If what you suggested doesn't work, could I stream my smartphone screen instead?

I saw that there is a similar issue, #111, but the example link https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/displayexample is no longer available.

pedroSG94 commented 3 months ago

This is the updated link: https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/screen You only need replace GenericStream with RtspServerStream and use startStream method without url