Closed mrdesai109 closed 6 months ago
Hello,
A read timeout is that you can connect to the server but you never receive a response from the server when you are waiting for a command response. I'm not sure about the reason but maybe a good idea could be read logs of the server and logs of my library to know the exact command that fail and the reason. If you can't connect to the server this should be the error:
SocketTimeoutException: failed to connect to X.X.X.X
rtmp://10.134.130.456:1935/live/test
rtmp://abc.123.com:1935/live/test
rtmp://abc.123.com/live/test
rtmps://10.134.130.456:1935/live/test
rtmps://abc.123.com:1935/live/test
rtmps://abc.123.com/live/test
This is all correct depend of your configuration. If you are using rtmps with a certificate maybe you need add it to the library this way: https://github.com/pedroSG94/RootEncoder/issues/1395#issuecomment-1935070444
Hey @pedroSG94 thanks for getting back.
I don't strictly need "rtmps". My question is, as I said my RTMP server is running on a publicly hosted Docker environment, with the domain being "https://abc.123.com" and the server IP being "10.134.130.456".
So using "rtmps", with SSL certificate configured in server side (Nginx in my case) and also in my Android app, mandatory?
Or just plain "rtmp://10.134.130.456:1935/live/test" is enough to connect and stream to my public server?
Yes, you can connect and stream using rtmp without SSL. Of course, in this case the stream is not encrypted.
If you have exactly the same configuration than in local network the only possible reason could be a problem in machine configuration. A full log of the reason String in the onConnectionFailed callback could help to debug it. Also, you can check the log of nginx to know if you can get more info about it. Other idea could be install the server without a docker to make sure that the problem is not related with the docker. You can even contact with your hoster to get more info about the possible reason.
Hey @pedroSG94, the connection worked and stream also was working. I dint change anything though. So we can confirm that SSL config is not mandatory for my publicly hosted Nginx RTMP server. I used this URL - "rtmp://10.134.130.456:1935/live/test".
But, as I was doing testing, I reinstalled the app. Now the same read time out issue came again. No idea what's the reason, can you help?
Here are the logs -
onConnectionStarted() : rtmp://10.134.130.456:1935/live/test
writing C0
C0 write successful
writing C1
writing time 1711966282 to c1
writing zero to c1
writing random to c1
C1 write successful
reading S0
connection error
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
at java.net.SocketInputStream.read(SocketInputStream.java:176)
at java.net.SocketInputStream.read(SocketInputStream.java:144)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
at java.io.BufferedInputStream.read(BufferedInputStream.java:267)
at com.pedro.rtmp.rtmp.Handshake.readS0(Handshake.kt:143)
at com.pedro.rtmp.rtmp.Handshake.sendHandshake(Handshake.kt:84)
at com.pedro.rtmp.rtmp.RtmpClient.establishConnection(RtmpClient.kt:331)
at com.pedro.rtmp.rtmp.RtmpClient.access$establishConnection(RtmpClient.kt:53)
at com.pedro.rtmp.rtmp.RtmpClient$connect$1.invokeSuspend(RtmpClient.kt:237)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
onConnectionFailed() : Error configure stream, Read timed out
It got solved, problem was with my server provider. Thanks @pedroSG94.
Hey @pedroSG94, need your assitance on this. I am new to RTMP streaming. Note that, everything works perfectly on localhost RTMP Nginx server. But problem is currently with my public server.
I have a publicly hosted Nginx server with RTMP module. But my I getting "Read timeout", basically connection failed from Android app. This Nginx server is running on a Docker environment. The server domain, lets consider is "https://abc.123.com", and the server IP lets consider 10.134.130.456. I used this command to start the container -
docker run -itd -p 1935:1935 --restart unless-stopped myUbuntuNginxImage
Also, I checked via netstat command that the port 1935 is open and listening for outside connections.
I am using this URL to connect to this server - "rtmp://10.134.130.456:1935/live/test" but the library is giving a timeout error.
I have couple of questions -
1) Is this happening because I have not specified the SSL certificate and key of the domain https://abc.123.com, in my nginx.conf?
2) While connecting and streaming to my public RTMP server what should be my URL?
This is my current nginx.conf for your reference -
Please help out with this?