Comments (9)
Hello,
I'm not caching anything in the library. This seems a code error in your side.
I tested using 2 servers and alternate with both and all is working fine
Are you sure that the url is correct? Did you check the url set to the library each time to know the value when it fails? (check it when you call displayBase?.startStream(url) line)
from rootencoder.
Hey @pedroSG94 , I confirm that URL being passed to the library is correct. I am having a localhost RTMP server.
The issue is happening specifically when I change my Wifi connection of laptop. On changing the Wifi connection, the IPV4 address of the laptop will change, right?
So, on changing the Wifi connection the RTMP URL will also change. At this point, the library is not able to make connection the RTMP server. But, now if I uninstall and reinstall the app it actually connects and streams successfully. Why this behavior? Do you think it's my code side issue?
Here is the exact log -
192.168.1.8 is the changed IPV4 address of my laptop.
URL - rtmp://192.168.1.8:1935/live/test
Also I am making sure that laptop and Android device both are connected to new Wifi.
connection error
java.net.SocketTimeoutException: failed to connect to /192.168.1.8 (port 1935) from /192.168.167.57 (port 32844) after 5000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:190)
at libcore.io.IoBridge.connect(IoBridge.java:134)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:621)
at com.pedro.rtmp.utils.socket.TcpSocket.connect(TcpSocket.kt:64)
at com.pedro.rtmp.rtmp.RtmpClient.establishConnection(RtmpClient.kt:327)
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)
from rootencoder.
Hello,
If you read the connection error you can check that you are not in the same network:
java.net.SocketTimeoutException: failed to connect to /192.168.1.8 (port 1935) from /192.168.167.57 (port 32844) after 5000ms
192.168.1.8 and 192.168.167.57 is not the same network. If you are the the same network the third number should be the same and only should change the last number.
The first one is your server IP as you said and the second one is your device IP.
The reason about if you uninstall the app and install again the app is working is maybe because you need wait a bit until your device get the correct IP.
from rootencoder.
@pedroSG94 That's a very good observation. I dint know that. Let me check why Android device is not getting the correct IP. I will get back to you as soon as possible.
from rootencoder.
@pedroSG94 I observed same thing is happening if I just turn off the Wifi, and reconnect my Android device to the same Wifi. The third digit becomes different.
failed to connect to /192.168.1.8 (port 1935) from /192.168.167.57 (port 55876) after 5000ms
It's only after I uninstall and reinstall the app, it will connect successfully.
As I noticed from the logs, that the library is using java.net.Socket() internally. Maybe problem lies there. Not sure.
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:621)
at com.pedro.rtmp.utils.socket.TcpSocket.connect(TcpSocket.kt:64)
Can you try to do this and let me know if you are facing the same issue as well?
- Connect to Wifi from Android device, and stream to RTMP server. Stop the stream.
- Turn Off Wifi of Android device.
- Turn On Wifi and connect to the same Wifi again, and try to stream.
from rootencoder.
Hello,
I haven't this problem.
Socket class is not related with your problem. I'm not using a class that can manipulate IP device or similar.
Try to reproduce the case using my app example to discard that it is an error related with your code. Also, you can check your current IP in the device settings to make sure that you are in the same network (wait until it is correct) and then click to start stream instead of automatize it.
If you have more than one router or wifi hotpots just shutdown all except one.
Also, you can configure your router to use always the same IP with your Android device and your server
from rootencoder.
@pedroSG94 It is happening with the example app too.
But I believe the issue is not related to library. I think on disabling and enabling Wifi, a different IP is assigned to Android device.
On disabling the Wifi and reconnecting to the Wifi, I can see the Android's IP is 192.168.1.2 in the Wifi settings. But when I try to connect to the RTMP server again, I still get the same error -
failed to connect to /192.168.1.8 (port 1935) from /192.168.167.57 (port 55236) after 5000ms
Definitely Android related issue, not the library I believe. I dont know how 192.168.167.57 is getting displayed. Also, as I mentioned earlier on doing uninstall and reinstall, connection is happening.
Any idea what is the root cause of this issue?
from rootencoder.
Also, as I mentioned earlier on doing uninstall and reinstall, connection is happening.
This has no sense for me. If you kill the app totally without uninstall, you should have the same result that uninstall app.
This feels like an error in your network configuration. I recommend you go to your router and configure a static IP to your Android device. Even a factory reset in your device could be a good idea.
Shutdown all devices that could be connected to your network except your server to avoid your router asign you other IP
from rootencoder.
Thanks @pedroSG94, I will try that. Closing this issue, since this is not a library related issue. Rather an Android side issue.
from rootencoder.
Related Issues (20)
- Retry Error configure stream, setup video 451 HOT 1
- Repeatedly Creating RtspServerStream and Encountering 'Create VideoEncoder failed' Issue HOT 1
- When I recording a video, how can I record a new video with a custom rect in camera frame HOT 4
- screen destory HOT 1
- Hello I'm using OpenGlView and want to set the Hue of the camera how to write. HOT 1
- App crashing while migrating to Android 14 from Android 13 HOT 10
- Recording video with multiple part, screen stuck HOT 13
- How to keep streaming when rotating device HOT 6
- RTMP Authentication not working HOT 3
- Switching between Rtmp stream audio and video HOT 7
- How to play multiple files with RtspServerFromFile HOT 6
- Echo Problem HOT 9
- Hello! I would like to ask you if this library can achieve screen recording and push stream, not through the camera through the screen recording to push the device picture and sound to the server. HOT 3
- Unstable FPS HOT 3
- Where can I download previous versions? HOT 7
- Local Screen Recording and Device Audio Recording HOT 5
- import issue HOT 2
- i can't streaming HOT 3
- Pause Record to File for GenericStream/StreamBase HOT 3
- WHIP & RIST Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rootencoder.