Skip to main content

How to set how long a dropped stream is held

Choose how long a publisher has to reconnect before the stream session ends

To control how long Native Frame waits for a publisher to reconnect after their stream drops, set your project's resume window.

When a publisher's connection drops, Native Frame holds the stream session open for the resume window instead of ending it. If the publisher reconnects inside the window, they continue in the same stream session. If they don't, the session ends, dated at the moment the stream stopped rather than when the window ran out.

Every project starts on the platform default. Set your own window when your publishers need more time to reconnect, such as on mobile networks, or less, so that a stream that has stopped ends sooner.

Prerequisites​

  • A service-account JWT for the project, held on your server. See Create Streams Server-Side. The window applies to the project the token belongs to, so no project ID goes in the request.

Procedure​

  1. Check whether the project already has a window set.

    GET /program/api/v2/resume-window
    Authorization: Bearer <jwt>

    200 returns the project's window:

    { "resumeWindowMs": 30000 }

    404 means no window is set and the platform default applies. This is the normal state, not an error.

  2. Set the window, in milliseconds.

    PUT /program/api/v2/resume-window
    Authorization: Bearer <jwt>
    Content-Type: application/json

    { "resumeWindowMs": 30000 }
    resumeWindowMsEffect
    2000 to 86400000Hold a dropped stream for 2 seconds up to 24 hours.
    -1No hold: the session ends as soon as the stream drops.

    0 is rejected. To turn the hold off, send -1. Any other value outside these ranges returns 400.

  3. To go back to the platform default, clear the window.

    DELETE /program/api/v2/resume-window
    Authorization: Bearer <jwt>

    This returns 204 whether or not a window was set.

A long window delays the recording

While a stream is held it is still live, and recording continues for the whole hold. A recorded stream that never reconnects finishes archiving only after its window runs out, so a 24-hour window can delay the archive by a day and adds to your storage use.

Result​

PUT answers 200 with the window as stored, and a GET returns the same value. From then on, a publisher who drops and reconnects inside that window continues the same stream session.