Skip to content

Seeking Guidance on Error Handling for Low-Bandwidth HLS Streams in Live and Recorded Scenarios #7934

Open
@jtdavis32608

Description

@jtdavis32608

Have you read the Tutorials?
yes

Have you read the FAQ and checked for duplicate open issues?
yes

If the question is related to FairPlay, have you read the tutorial?

n/a

What version of Shaka Player are you using?
4.12.8

What browser and OS are you using?
Chrome and Windows Server 2022

Please ask your question
Can we get guidance on error handling for Shaka Player? We have 2 primary use-cases:

Use Case 1: Live Streaming
Stream details:
Low-bandwidth proxy stream (~500 KBps)
MPEG-TS format
Segment duration: ~1 second
Playlist contains 10 segments

In this scenario, the player generally performs well. However, when playing multiple streams in a multi-viewer setup (multiple streams on one page), we observe that, over time (maybe 2 to 5 minutes), individual streams eventually stall, freeze, or stop. This issue does not appear to be related to a physical network problem, as it affects streams independently rather than simultaneously.

Use Case 2: Recorded Playback
Stream details:
Low-bandwidth proxy stream (~500 KBps)
MPEG-TS format
All segments retained (no limit on segment count)
Playback starts ~5 seconds after recording begins

Most of the time, playback starts as expected. However, in some cases, the player fails to start playback, with no clear indication of the cause.

We have setup buffering in the player configuration. We are also handling error events and buffering events.
Here is the configuration and error handling we have implemented:

player.configure({
manifest: {
hls: {
ignoreTextStreamFailures: true, // Ignore subtitle errors
},
},
streaming: {
bufferingGoal: 1, // Buffering goal of 1 second
rebufferingGoal: 1, // Minimum buffer level to resume playback
retryParameters: {
maxAttempts: 5, // Retry failed network requests 5 times
baseDelay: 1000, // 1 second between retry attempts
},
},
});

player.addEventListener('buffering', event => {
if (event.buffering) {
Logger.debug('Buffering starting');
setTimeout(() => {
if (player.isBuffering()) {
Logger.debug('Retrying stream');
player.retryStreaming();
}
}, 5000);
} else {
Logger.debug('Video is playing');
}
});

player.addEventListener('error', onErrorEvent);

const onErrorEvent = (event) => {
onError(event.detail);
};

const onError = (error) => {
Logger.debug('Error code', error.code, 'object', error, ' Element ', videoPath);
if (error.code === shaka.util.Error.Code.BAD_HTTP_STATUS) {
Logger.debug('Stream reset detected. Retrying...');
player.load(videoPath).catch(onError);
}
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: waiting on responseWaiting on a response from the reporter(s) of the issuetype: questionA question from the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions