- Newest
- Most votes
- Most comments
Based on your description, it appears you're facing challenges with WebRTC connectivity using Amazon Kinesis Video Streams (KVS) across different network environments. Let's address your concerns and provide some troubleshooting steps:
-
Cross-network connectivity issues are common with WebRTC, especially when NATs and firewalls are involved. The fact that your connection works on the same WiFi network but fails across different networks suggests that your STUN/TURN configuration might need adjustment.
-
For the TURN server relay mode failure, even on the same network, this could indicate an issue with your TURN server configuration or credentials.
To address these issues:
-
Increase the ICE timeouts to allow more time for candidate gathering and connectivity checks. You can adjust the following parameters:
- iceConnectionCheckTimeout: Increase this for unstable or slow networks.
- iceCandidateNominationTimeout: Increase this to ensure candidate pairs with local relay candidates are tried.
- iceConnectionCheckPollingInterval: Adjust this to change the frequency of connectivity checks.
-
Verify your TURN server configuration. Ensure that the TURN credentials are correct and not expired. KVS TURN servers should be capable of relaying WebRTC traffic across different networks when configured correctly.
-
Enable verbose logging for ICE candidates and connection states. This will help you identify where exactly the connection is failing.
-
Check your network configuration to ensure all required endpoints for KVS WebRTC are accessible, including STUN and TURN servers.
-
Implement proper error handling in your application to catch and respond to disconnection events.
-
Use the AWS CLI to describe the Kinesis Video Streams signaling channel endpoints:
aws kinesisvideo describe-signaling-channel
This will help verify that your STUN and TURN servers are configured correctly.
-
Review the WebRTC logs from both successful (same network) and failed (different network) connection attempts. Look for differences in ICE candidate generation and negotiation.
-
Regarding TTL for ICE server credentials, KVS typically handles this automatically. However, ensure you're using the latest credentials for each connection attempt.
-
For network diagnostics, you can use tools like WebRTC Internals in Chrome to gather detailed information about the ICE candidates and connection process.
-
Region configuration shouldn't significantly affect TURN server performance, but ensure you're using the correct region for your KVS resources.
If these steps don't resolve the issue, you may need to implement your own reconnection logic to handle cases where the SDK fails to connect automatically. Also, consider updating to the latest version of the Amazon KVS WebRTC SDK, as newer versions may have resolved similar connectivity issues.
Remember, WebRTC connections can be complex, especially across different network environments. Proper error handling and connection state management are crucial for robust WebRTC applications.
Sources
Troubleshooting Amazon Kinesis Video Streams with WebRTC - Kinesis Video Streams
kvsWebrtcClientMasterGstSample: viewer failed to connect back when disconnected until app restarted, operation returned status code: 0x5a000025 | AWS re:Post
WebRTC configuration on Prod | AWS re:Post
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
In addition to the generated response below, which contains some of the troubleshooting steps I would recommend, would you also please test using the standard KVS WebRTC test page to rule out any issues? https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html
If you can reproduce the issue using the KVS WebRTC test page, which also allows you to select various NAT traversal settings (STUN/TURN, TURN Only, STUN Only), then we could look at specific troubleshooting steps based on which scenario is causing issues.
Thank you for the suggestion. I tested using the standard KVS WebRTC test page at https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html, and it works fine there. The issue does not appear when using the test page, including under various NAT traversal settings (STUN/TURN, TURN Only, STUN Only).