Discussions

Ask a Question
Back to all

Request for Detailed Guidance on Network Fallback Implementation in @heygen/streaming-avatar

We’re using @heygen/streaming-avatar v2.0.14 for an interactive web-based avatar integration and are facing a few consistent performance issues:

Jerky or delayed speech responses:
After the avatar connects, it sometimes becomes laggy or takes several seconds to process and respond to queries.

Session instability:
Occasionally, the avatar fails to connect or remains stuck in “connecting” or “closing” states. We often have to reload the page or create a new session to restore it, which disrupts our workflow.

Session timeout configuration:
We’ve reviewed the activityIdleTimeout parameter (default 120s) but would appreciate guidance on the optimal configuration for longer active sessions without impacting responsiveness.

Network fallback behavior:
We understand the system automatically falls back from UDP to TCP when UDP is blocked.

Could you please explain how this fallback is handled internally?

Are there configuration parameters or code-level hooks to optimize or detect when the fallback occurs?

Is there a recommended way to monitor connection type (UDP vs TCP) or quality for debugging performance issues?

Since our users connect from multiple uncontrolled networks (corporate, hospital, and public), we can’t modify firewall rules. We’d like to ensure a consistent avatar experience even in such varied network conditions.

Any diagnostic tools, configuration recommendations, or sample implementations you can provide to improve reliability and reduce latency would be greatly appreciated.

Thank you for your support.