Skip to content

Commit

Permalink
Fix regression that removed (unofficial) support for startLevel abo…
Browse files Browse the repository at this point in the history
…ve max level index

Fixes #6172

(cherry picked from commit 88d54a9)
  • Loading branch information
robwalch committed Feb 7, 2024
1 parent 88a480a commit e93f0bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ Enable to use JavaScript version AES decryption for fallback of WebCrypto API.

(default: `undefined`)

When set, use this level as the default hls.startLevel. Keep in mind that the startLevel set with the API takes precedence over config.startLevel configuration parameter.
When set, use this level as the default `hls.startLevel`. Keep in mind that the `startLevel` set with the API takes precedence over config.startLevel configuration parameter. `startLevel` should be set to value between 0 and the maximum index of `hls.levels`.

### `fragLoadingTimeOut` / `manifestLoadingTimeOut` / `levelLoadingTimeOut` (deprecated)

Expand Down
5 changes: 3 additions & 2 deletions src/controller/abr-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,9 @@ class AbrController extends Logger implements AbrComponentAPI {
}

public set nextAutoLevel(nextLevel: number) {
const value = Math.max(this.hls.minAutoLevel, nextLevel);
if (this._nextAutoLevel != value) {
const { maxAutoLevel, minAutoLevel } = this.hls;
const value = Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
if (this._nextAutoLevel !== value) {
this.nextAutoLevelKey = '';
this._nextAutoLevel = value;
}
Expand Down
3 changes: 2 additions & 1 deletion src/controller/stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ export default class StreamController
}
// set new level to playlist loader : this will trigger start level load
// hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded
this.level = hls.nextLoadLevel = startLevel;
hls.nextLoadLevel = startLevel;
this.level = hls.loadLevel;
this.loadedmetadata = false;
}
// if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime
Expand Down

0 comments on commit e93f0bb

Please sign in to comment.