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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation - Add interface for AbrController #4842

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,9 @@ var config = {

Customized Adaptive Bitrate Streaming Controller.

Parameter should be a class providing 2 getters, 2 setters and a `destroy()` method:
Parameter should be a class providing a getter/setter and a `destroy()` method:

- get/set `nextAutoLevel`: return next auto-quality level/force next auto-quality level that should be returned (currently used for emergency switch down)
- get/set `autoLevelCapping`: capping/max level value that could be used by ABR Controller
- `destroy()`: should clean-up all used resources

For `hls.bandwidthEstimate()` to return an estimate from your custom controller, it will also need to satisfy `abrController.bwEstimator.getEstimate()`.
Expand Down
4 changes: 2 additions & 2 deletions src/controller/abr-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import type {
ErrorData,
LevelLoadedData,
} from '../types/events';
import type { ComponentAPI } from '../types/component-api';
import type { AbrComponentAPI } from '../types/component-api';

class AbrController implements ComponentAPI {
class AbrController implements AbrComponentAPI {
protected hls: Hls;
private lastLoadedFragLevel: number = 0;
private _nextAutoLevel: number = -1;
Expand Down
7 changes: 7 additions & 0 deletions src/types/component-api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import EwmaBandWidthEstimator from '../utils/ewma-bandwidth-estimator';

export interface ComponentAPI {
destroy(): void;
}

export interface AbrComponentAPI extends ComponentAPI {
nextAutoLevel: Number;
readonly bwEstimator?: EwmaBandWidthEstimator;
}

export interface NetworkComponentAPI extends ComponentAPI {
startLoad(startPosition: number): void;
stopLoad(): void;
Expand Down