D-ID Client SDK - v3.0.0-0
    Preparing search index...

    Class StreamError

    Something went wrong inside the live audio and video stream.

    Unlike HttpError and NetworkError, which come from REST calls, this one comes from the transport carrying the agent's video, so it is only ever delivered to onError — no call of yours is necessarily in flight when it happens, and nothing throws it. The SDK raises it when:

    • no media track is subscribed within the timeout after the LiveKit room used by Expressive (V4) agents connects, after which the SDK disconnects the stream;
    • the LiveKit room reports a media-device or encryption failure;
    • a message cannot be put on the data channel — the WebRTC channel used by Talks (V2) and Clips (V3) is not open, or the LiveKit room is not connected or rejects the send;
    • the server reports that the stream itself failed, with the message Stream failed with event <event>.

    Most of these leave the session unusable, so the useful response is to tell the user and call reconnect(). kind is 'StreamError'. The message describes the failure, and is the plain 'Stream Error' when the transport gave no detail; the underlying error, where there was one, is kept as originalError.

    Hierarchy (View Summary)

    Index
    kind: "StreamError" = 'StreamError'

    Always 'StreamError'. Branch on it to tell this failure from the other SDK errors.

    originalError?: unknown

    The error or value that caused this one, when the SDK was wrapping something else.

    For a NetworkError this is the browser's own fetch rejection. It is not serialized as-is: toJson() takes only an Error cause's message.

    • Serializes the error into the JSON-safe ErrorJson payload for logging or reporting.

      The payload always carries kind and the message. The cause's message is added only when originalError is an Error and says something the message does not, truncated to 256 characters; any other cause is dropped. Subclasses extend the payload with the fields listed on their own pages.

      Returns ErrorJson

      The error as plain, JSON-serializable data.

      {
      "kind": "HttpError",
      "code": "InsufficientCreditsError",
      "message": "Account has insufficient credits",
      "httpStatus": 402,
      "endpoint": "/agt_x/chat/cht_y",
      "method": "POST"
      }
      {
      "kind": "NetworkError",
      "message": "Network request failed",
      "cause": "Failed to fetch",
      "endpoint": "/agt_x/chat/cht_y",
      "method": "POST",
      "durationMs": 12,
      "online": false,
      "visibility": "visible"
      }