mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 05:43:50 +02:00
Update docs for getRetryDelay()
This commit is contained in:
@@ -487,7 +487,7 @@ If you're using this source in the browser and the URL is on a different origin,
|
|||||||
```ts
|
```ts
|
||||||
type UrlSourceOptions = {
|
type UrlSourceOptions = {
|
||||||
requestInit?: RequestInit;
|
requestInit?: RequestInit;
|
||||||
getRetryDelay?: (previousAttempts: number) => number | null;
|
getRetryDelay?: (previousAttempts: number, error: unknown, url: string | URL | Request) => number | null;
|
||||||
|
|
||||||
// The maximum number of bytes the cache is allowed to hold
|
// The maximum number of bytes the cache is allowed to hold
|
||||||
// in memory. Defaults to 8 MiB.
|
// in memory. Defaults to 8 MiB.
|
||||||
@@ -517,7 +517,9 @@ const source = new UrlSource('https://example.com/bigbuckbunny.mp4', {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Not setting `getRetryDelay` will default to an infinite, capped exponential backoff pattern. If a CORS error is suspected (`fetch()` did reject even though `navigator.onLine` is true), no further retries will be made.
|
Not setting `getRetryDelay` will lead to the default being used:
|
||||||
|
- infinite exponential backoff pattern, capped at 16 seconds.
|
||||||
|
- If a CORS error is suspected (`fetch()` did reject even though `navigator.onLine` is true and origin is different), no further retries will be made.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -306,7 +306,7 @@ export type UrlSourceOptions = {
|
|||||||
* failed. If the function returns `null`, no more retries will be made.
|
* failed. If the function returns `null`, no more retries will be made.
|
||||||
*
|
*
|
||||||
* By default, it uses an exponential backoff algorithm that never gives up unless
|
* By default, it uses an exponential backoff algorithm that never gives up unless
|
||||||
* a CORS error is suspected (`fetch()` did reject even though `navigator.onLine` is true)
|
* a CORS error is suspected (`fetch()` did reject, `navigator.onLine` is true and origin is different)
|
||||||
*/
|
*/
|
||||||
getRetryDelay?: (previousAttempts: number, error: unknown, url: string | URL | Request) => number | null;
|
getRetryDelay?: (previousAttempts: number, error: unknown, url: string | URL | Request) => number | null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user