Skip to content

Commit

Permalink
Merge pull request #62 from apivideo/hotkeys-parameter
Browse files Browse the repository at this point in the history
Add hotkeys parameter
  • Loading branch information
olivier-lando authored Jun 19, 2024
2 parents 3e3e15e + bca0702 commit bc2021a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All changes to this project will be documented in this file.

## [1.2.30] - 2024-06-19

- Add hotkeys parameter

## [1.2.29] - 2024-06-19

- Add custom domain
Expand Down
63 changes: 32 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
## Table of contents

- [Table of contents](#table-of-contents)
- [Project description](#project-description)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Method #1: requirejs](#method-1-requirejs)
- [Method #2: typescript](#method-2-typescript)
- [Method #2: simple include in a javascript project](#method-2-simple-include-in-a-javascript-project)
- [Documentation](#documentation)
- [Instantiation](#instantiation)
- [Ads](#ads)
- [Methods](#methods)
- [Full example](#full-example)
- [Control an existing embedded player using the SDK](#control-an-existing-embedded-player-using-the-sdk)
- [Project description](#project-description)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Method #1: requirejs](#method-1-requirejs)
- [Method #2: typescript](#method-2-typescript)
- [Method #2: simple include in a javascript project](#method-2-simple-include-in-a-javascript-project)
- [Documentation](#documentation)
- [Instantiation](#instantiation)
- [Ads](#ads)
- [Methods](#methods)
- [Full example](#full-example)
- [Control an existing embedded player using the SDK](#control-an-existing-embedded-player-using-the-sdk)

<!--</documentation_excluded>-->

Expand Down Expand Up @@ -116,25 +116,26 @@ The PlayerSdk constructor takes 2 parameters:
- `targetSelector: string | Element` a CSS selector targeting the DOM element in which you want to create the player (eg. "#target"), or the DOM element itself
- `options: SdkOptions` an object containing the player options. The available options are the following:

| Option name | Mandatory | Type | Description |
| -------------: | --------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| id | **yes** | string | the id of the video (videoId or liveStreamId) |
| token | yes for private video | string | the [private video](https://api.video/blog/tutorials/tutorial-private-videos/) url token |
| privateSession | no | string | the [private video](https://api.video/blog/tutorials/tutorial-private-videos/) session id if needed |
| live | no (default: false) | boolean | indicate that the video is a live one |
| autoplay | no (default: false) | boolean | start playing the video as soon as it is loaded |
| muted | no (default: false) | boolean | the video is muted |
| metadata | no (default: empty) | object | object containing [metadata](https://api.video/blog/tutorials/dynamic-metadata/) (see **Full example** below) |
| hideControls | no (default: false) | boolean | the controls are hidden (except unmute button if the video starts muted) |
| chromeless | no (default: false) | boolean | chromeless mode: all controls are hidden |
| hideTitle | no (default: false) | boolean | the video title is hidden |
| hidePoster | no (default: false) | boolean | the poster image isn't displayed |
| showSubtitles | no (default: false) | boolean | the video subtitles are shown by default |
| loop | no (default: false) | boolean | once the video is finished it automatically starts again |
| playbackRate | no (default: 1) | number | the playback rate of the video: 1 for normal, 2 for x2, etc. |
| sequence | no | {start: number, end: number} | define a sequence of the video to play. The video will start at the `start` timecode and end at the `end` timecode. The timecodes are in seconds. |
| ads | no | {adTagUrl: string} | see below [ads](#ads) |
| customDomain | no | string | if you've enabled Custom Domains for your account, the complete 'embed' domain (eg. embed.mydomain.com) |
| Option name | Mandatory | Type | Description |
| -------------: | --------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| id | **yes** | string | the id of the video (videoId or liveStreamId) |
| token | yes for private video | string | the [private video](https://api.video/blog/tutorials/tutorial-private-videos/) url token |
| privateSession | no | string | the [private video](https://api.video/blog/tutorials/tutorial-private-videos/) session id if needed |
| live | no (default: false) | boolean | indicate that the video is a live one |
| autoplay | no (default: false) | boolean | start playing the video as soon as it is loaded |
| muted | no (default: false) | boolean | the video is muted |
| metadata | no (default: empty) | object | object containing [metadata](https://api.video/blog/tutorials/dynamic-metadata/) (see **Full example** below) |
| hideControls | no (default: false) | boolean | the controls are hidden (except unmute button if the video starts muted) |
| chromeless | no (default: false) | boolean | chromeless mode: all controls are hidden |
| hideTitle | no (default: false) | boolean | the video title is hidden |
| hidePoster | no (default: false) | boolean | the poster image isn't displayed |
| showSubtitles | no (default: false) | boolean | the video subtitles are shown by default |
| loop | no (default: false) | boolean | once the video is finished it automatically starts again |
| playbackRate | no (default: 1) | number | the playback rate of the video: 1 for normal, 2 for x2, etc. |
| sequence | no | `{start: number, end: number}` | define a sequence of the video to play. The video will start at the `start` timecode and end at the `end` timecode. The timecodes are in seconds. |
| ads | no | `{adTagUrl: string}` | see below [ads](#ads) |
| customDomain | no | string | if you've enabled Custom Domains for your account, the complete 'embed' domain (eg. embed.mydomain.com) |
| hotkeys | no (default: true) | boolean | if false, deactivate the player's hotkeys to prevent it from capturing focus, which can be beneficial in certain scenarios |

The sdk instance can be used to control the video playback, and to listen to player events.

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

type PlayerSdkEvent = {
Expand Down Expand Up @@ -446,6 +447,10 @@ export class PlayerSdk {
url = addParameterInIframeHash("hide-controls");
}

if (options.hotKeys !== undefined && !options.hotKeys) {
url = addParameterInIframeHash("hotkeys:false");
}

if (options.chromeless === true) {
url = addParameterInIframeHash("chromeless");
}
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.29",
"version": "1.2.30",
"description": "api.video player SDK",
"repository": {
"type": "git",
Expand Down

0 comments on commit bc2021a

Please sign in to comment.