Closed Mett-Barr closed 8 months ago
Hello,
The problem is that you are not rendering the SurfaceTexture provided by VideoSource correctly. You are rendering SurfaceTexture from the TextureView so you have a preview but no data in the stream.
You only need create a VideoSource like here: https://github.com/pedroSG94/RootEncoder/blob/master/library/src/main/java/com/pedro/library/util/sources/video/Camera2Source.kt In this case you need replace Camera2ApiManager with your CameraController.
After that, you can add your TextureView as preview with startPreview method like here: https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/rotation/CameraFragment.kt#L106 You can use TextureView with TextureView.SurfaceTextureListener to replace SurfaceView with SurfaceHolder.Callback
Thank you for your response. Here is the current approach I'm using, and I'm unsure where the mistake lies:
Hello,
First of all try to use RtspServerStream without a custom VideoSource to make sure that your code is working as expected, you can use Rotation example of the app module in RootEncoder project as guide. You also have a mini guide here: https://github.com/pedroSG94/RootEncoder/wiki/StreamBase-(in-progress)#quick-start
After that, you only need create a class (your custom VideoSource) and set that source in the RtspServerStream constructor like the second code example of the mini guide.
You are miss understanding the way the library works: 1 - You don't need wait until TextureView is available, you only need wait for it to use the startPreview/stopPreview. So you can instantiate RtspServerStream, CameraController and CameraVideoSource and prepare video/audio before TextureView is ready and call startPreview when you receive onSurfaceTextureAvailable 2 - This is not the way the library works. VideoSource is a class where the library read video data to work but it is not related with the preview. The library copy data provided from VideoSource class to the TextureView used in startPreview method for you. 3 - Remember call release method when you are closing the activity to release properly. This basically stop all and release resources of RtspServerStream class
Thank you for your help; the issue has been resolved. I accidentally returned the wrong Boolean in VideoSource's override fun isRunning(), which prevented override fun start from executing. This problem has now been completely resolved. I am very grateful for your assistance.
Closing issue, you can reopen or open other issue if needed
Due to the need for full control over the Camera, I am using RtspServerStream to treat the content of CameraPreview as the video source. While the CameraPreview displays successfully, RtspServerStream is unable to retrieve the content from the Surface. Is there something incorrect in the way I am using it?
Example URL : https://github.com/Mett-Barr/rtsp-test