Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jtdavis32608 opened this issue Jan 23, 2025 · 0 comments
Labels
type: question A question from the community

Comments

@jtdavis32608
Copy link

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);
}
};

@jtdavis32608 jtdavis32608 added the type: question A question from the community label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question A question from the community
Projects
None yet
Development

No branches or pull requests

1 participant