Skip to content

Commit

Permalink
Experimental features
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-lando committed Dec 11, 2023
1 parent 113a110 commit c09d90e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [1.2.28] - 2023-12-11
- Add experimental methods

## [1.2.27] - 2023-12-08
- Add chromecast & airplay events

Expand Down
26 changes: 26 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ type SdkOptions = {
start: number;
end: number;
}
// This feature is experimental.
// It may change or be removed at any time and could cause significant playback issues.
minimalQuality?: number;
// This feature is experimental.
// It may change or be removed at any time and could cause significant playback issues.
maximalQuality?: number;
}

type PlayerSdkEvent = {
Expand Down Expand Up @@ -174,6 +180,18 @@ export class PlayerSdk {
this.postMessage({ message: 'setStyleProperty', query: ".vjs-poster", property: "background-size", value }, undefined, false);
}

// This feature is experimental.
// It may change or be removed at any time and could cause significant playback issues.
setMinimalQuality(quality: number) {
this.postMessage({ message: "setMinimalQuality", quality})
};

// This feature is experimental.
// It may change or be removed at any time and could cause significant playback issues.
setMaximalQuality(quality: number) {
this.postMessage({ message: "setMaximalQuality", quality})
};

hideControls(controls?: ControlName[]) {
if(!controls) {
this.options.hideControls = true;
Expand Down Expand Up @@ -365,6 +383,14 @@ export class PlayerSdk {
url = addParameterInIframeHash("show-subtitles");
}

if(options.minimalQuality !== undefined) {
url = addParameterInIframeHash(`min-quality:${encodeURIComponent(options.minimalQuality)}`);
}

if(options.maximalQuality !== undefined) {
url = addParameterInIframeHash(`max-quality:${encodeURIComponent(options.maximalQuality)}`);
}

if(options.ads?.adTagUrl) {
url = addParameterInIframeHash(`adTagUrl:${encodeURIComponent(options.ads?.adTagUrl)}`);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@api.video/player-sdk",
"version": "1.2.27",
"version": "1.2.28",
"description": "api.video player SDK",
"repository": {
"type": "git",
Expand Down

0 comments on commit c09d90e

Please sign in to comment.