From eea1e4afc13b8e6d7b41c41c2fee2a066a4e013b Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Thu, 25 Jan 2024 16:54:23 +0100 Subject: [PATCH] Add examples for the ABR rules --- pages/advanced/abr/abandon-request-rule.md | 19 +++++++++++++++++++ pages/advanced/abr/throughput-calculation.md | 4 ++++ pages/advanced/abr/throughput-rule.md | 16 ++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/pages/advanced/abr/abandon-request-rule.md b/pages/advanced/abr/abandon-request-rule.md index c75dae8595..fa4364b8a4 100644 --- a/pages/advanced/abr/abandon-request-rule.md +++ b/pages/advanced/abr/abandon-request-rule.md @@ -53,4 +53,23 @@ if (remainingBytesToDownload > totalBytesForOptimalRepresentation) { | `minThroughputSamplesThreshold` | Minimum throughput samples (equivalent to number of `progress` events) required before the `AbandonRequestRule` kicks in. | +## Example +```js +player.updateSettings({ + streaming: { + abr: { + activeRules: { + abandonRequestsRule: { + active: true, + parameters: { + abandonDurationMultiplier: 1.8, + minSegmentDownloadTimeThresholdInMs: 500, + minThroughputSamplesThreshold: 6 + } + } + } + } + } +}); +``` diff --git a/pages/advanced/abr/throughput-calculation.md b/pages/advanced/abr/throughput-calculation.md index e8cb59548c..a62e353ad7 100644 --- a/pages/advanced/abr/throughput-calculation.md +++ b/pages/advanced/abr/throughput-calculation.md @@ -7,8 +7,11 @@ grand_parent: Advanced Features # Throughput Calculation +## Description dash.js provides multiple options to configure the calculation of the current average throughput. This calculation is an important input for most of the ABR rules e.g. the [ThroughputRule](throughput-rule.html). + +## Configuration Options The following options are available: | Throughput Calculation Mode | Description | @@ -25,6 +28,7 @@ The following options are available: The default mode is `EWMA`. Most of the throughput calculation modes work on a fixed number of throughput samples. The `settings.abr.throughput.sampleSettings` objects allows the configuration of sample related settings. +## Example In the example below we change the default mode to byte size weighted harmonic mean. In addition, we change the number of samples to be used to five and disable the automatic adjustment of the sample size. diff --git a/pages/advanced/abr/throughput-rule.md b/pages/advanced/abr/throughput-rule.md index ec7e271836..f40a6a40a7 100644 --- a/pages/advanced/abr/throughput-rule.md +++ b/pages/advanced/abr/throughput-rule.md @@ -24,3 +24,19 @@ switchRequest.representation = abrController.getOptimalRepresentationForBitrate( There are no values that are specifically targeting the rule. However, there are some throughput related parameters that implicitly influence this rule as it is using `throughputController.getSafeAverageThroughput()`. The throughput related parameters are documented [here](throughput-calculation.html). + +## Example + +```js +player.updateSettings({ + streaming: { + abr: { + activeRules: { + throughputRule: { + active: true + } + } + } + } +}); +```