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

Provide more application control over streaming retry behavior #960

Closed
joeyparrish opened this issue Aug 9, 2017 · 5 comments
Closed

Provide more application control over streaming retry behavior #960

joeyparrish opened this issue Aug 9, 2017 · 5 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@joeyparrish
Copy link
Member

It is not sufficiently easy for application to control retry behavior. We allow detailed configuration at the networking level (NetworkingEngine and the various retryParameters configs) but not at the streaming level (StreamingEngine and streaming config).

Summary of previous discussions and work in this area:

Previous behavior (v2.0.0 - v2.1.2):

  • all types: keep retrying on failure

Current behavior (v2.1.3 - v2.1.6):

  • VOD: stop on failure
  • live: use streaming.infiniteRetriesForLiveStreams config to decide behavior (default true)

Proposed new behavior (v2.2.0+):

  • all types: invoke a configurable callback to decide behavior

The default callback would be along these lines and would reproduce current default behavior:

function defaultStreamingFailureCallback(error) {
  if (player.isLive()) {
    if (player.getConfiguration().streaming.infiniteRetriesForLiveStreams) {
      player.retryStreaming();
    }
  }
}

The infiniteRetriesForLiveStreams config would become deprecated and scheduled for removal in v2.3.0.

The application could achieve any of the previous behaviors through the callback, or any custom logic desired. For example:

function alwaysRetryOnFailureCallback(error) {
  player.retryStreaming();
}

function neverRetryCallback(error) {}

function retryLiveOnFailureCallback(error) {
  if (player.isLive()) {
    player.retryStreaming();
  }
}

function retryOnSpecificHttpErrorsCallback(error) {
  if (error.code == shaka.util.Error.Code.BAD_HTTP_STATUS) {
    var statusCode = error.data[1];
    var retryCodes = [ 502, 503, 504, 520 ];
    if (retryCodes.indexOf(statusCode >= 0)) {
      player.retryStreaming();
    }
  }
}

The retryStreaming() method would be exported from Player and could be called from outside the callback as well. The callback would not replace or modify the behavior of existing error events. So applications could:

  • choose to delay action until a user has been prompted
  • react to a dispatched error event instead of through the callback mechanism
  • delay action while offline and retry streaming once the browser is back online

Would this proposal meet everyone's needs? Would it be best to keep the default behavior as-is (no auto-retry for VOD, infinite auto-retry for live)? Or should we select a new default starting in v2.2 or v2.3 (such as no auto-retries at all)?

@worg
Copy link

worg commented Aug 9, 2017

I think a callback would be a great way to have a fine grained control over retries and also it would allow us to have stats on which network requests are failing and why.
The fact that this new implementation would fallback to the current default behavior should be transparent for those not needing more control over network retries.
Thanks

@Ross-cz
Copy link
Contributor

Ross-cz commented Aug 10, 2017

Hi guys, it looks very promising! I am looking forward to see this logic committed.

shaka-bot pushed a commit that referenced this issue Aug 10, 2017
This is just cleanup before we tackle real issues around
StreamingEngine retry behavior.

Issue #960

Change-Id: I66bb80db9ee1fd469c0aa6c089313ba4ecf75101
@joeyparrish
Copy link
Member Author

Okay, I'm going to consider that a consensus and move forward with the implementation. We haven't heard from @bhh1988 or @boredom2 yet, but we'd still love to hear your feedback if you have any.

shaka-bot pushed a commit that referenced this issue Aug 10, 2017
This method will allow applications to retry streaming after a
failure.

Issue #960

Change-Id: I2c97f6dea44dbc9431182172101f99d740ea177f
@boredom2
Copy link

This is outstandingly awesome and absolutely brillant :)
I love it and its working for our Case as if it was designed for exactly this Purpose.
Thanks a lot!

@joeyparrish
Copy link
Member Author

Yay! Glad to hear it!

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants