Skip to main content
Skip table of contents

DASH segment download resiliency

Network issues may affect the timely retrieval of DASH stream segments. The CONNECT Player SDK for Browsers/ConnectedTV allows for adjustments in the resiliency of downloading of segments. A configurable timeout on segment download enables you to apply a multiplication factor to the rendered length of the segment. Segment downloads that fail to complete within this time will be retried.

Retries in this case are as if a 404 was received. The number of retries is limited and will apply the existing adaptive bitrate selection algorithm, which considers buffered levels and download speed history.

Example code

Using different settings on a stream-by-stream basis may be desirable as the segment length is likely to vary between Live and VOD streams. The configuration can optionally be set per stream by simultaneously setting the flag(s) as passing the URL, MIME type and token in the loaded callback. The default configuration will set timeouts of 500% of segment length for VOD streams and 150% for Live. Both defaults will be restricted to the interval 6000-15000 (6-15 seconds).

Through playback source

The example below ensures that two-second long segments will be allowed 200% of their segment length (4 seconds) to complete their download.

JS
const playerInstance = otvplayer(
    "videoPlayer",
    {
        plugins: {
            otvtoolkit: {}
        }
    },
    () => {
        playerInstance.src({
            src: "https://....",
            type: "application/dash+xml",
            token: "eyJra...",
            vodSegmentTimeout: 2,
            liveSegmentTimeout: 2
        });
    }
);

When the liveSegmentTimeout and vodSegmentTimeout values are omitted, the app will use the defaults listed above. If either liveSegmentTimeout or vodSegmentTimeout is specified, the resulting timeouts will not be limited to the default interval.

Through otvtoolkit configure API

The SDK has a set of default optimised values to configure the Shaka engine. A configure() API is provided to enable the application to optimise the configuration in the application end-to-end ecosystem.

The SDK optimises the segment timeout and maxAttempts by default, with the value passed via source API or SDK-recommended default value. The application will have to wait until the canPlay event has been received to override these settings. You can set the timeout using the streaming.retryParameters.timeout field with OtvToolkit.configure():

JS
playerInstance
   .otvtoolkit()
   .configure("streaming.retryParameters.timeout", 10000);

This sets the timeout on the current stream to 10000ms. See the API documentation for more details on OtvToolkit.configure(). The timeout can also be disabled by setting it to 0, effectively marking it as unlimited. Once a new stream is selected, the segment timeout will return to being calculated using the segment timeout multiplier.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.