diff options
author | Manuel Raynaud <manu@raynaud.io> | 2020-12-20 10:18:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-20 20:18:53 +1100 |
commit | 32a4039f7c2b94d334b7e66fd560de041654c5b4 (patch) | |
tree | a6fd78d93cac73fca044e3f12dfc78a38d7f1503 /src/js/plyr.d.ts | |
parent | c853adc760c92db32b4360bf0d3bd8b7b709d426 (diff) | |
download | plyr-32a4039f7c2b94d334b7e66fd560de041654c5b4.tar.lz plyr-32a4039f7c2b94d334b7e66fd560de041654c5b4.tar.xz plyr-32a4039f7c2b94d334b7e66fd560de041654c5b4.zip |
Enhance types (#1841)
* 🏷️(type) enhance QualityOptions type
Some optional properties in the QualityOptions were missing. The forced
and onChange property allwoing to use an external handler.
* ♻️(type) use Plyr.Provider for the readonly provider property
A type exists to define all available providers. This type isn't used in
the Plyr class definition and the same provider list is also defined.
This code is refactored to use the Plyr.Provider type
* 🏷️(type) add missing elements property in Plyr class
In Plyr class, you can access elements set in cache. This property is
missing in the class definition. The Plyr.Elements is for now
incomplete.
Diffstat (limited to 'src/js/plyr.d.ts')
-rw-r--r-- | src/js/plyr.d.ts | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/js/plyr.d.ts b/src/js/plyr.d.ts index 4b332aeb..479cfa98 100644 --- a/src/js/plyr.d.ts +++ b/src/js/plyr.d.ts @@ -139,9 +139,14 @@ declare class Plyr { ratio?: string; /** + * Access Elements cache + */ + elements: Plyr.Elements; + + /** * Returns the current video Provider */ - readonly provider: 'html5' | 'vimeo' | 'youtube'; + readonly provider: Plyr.Provider; /** * Returns the native API for Vimeo or Youtube players @@ -510,6 +515,8 @@ declare namespace Plyr { interface QualityOptions { default: number; + forced?: boolean; + onChange?: (quality: number) => void; options: number[]; } @@ -560,6 +567,27 @@ declare namespace Plyr { src?: string | string[]; } + export interface Elements { + buttons: { + airplay?: HTMLButtonElement; + captions?: HTMLButtonElement; + download?: HTMLButtonElement; + fastForward?: HTMLButtonElement; + fullscreen?: HTMLButtonElement; + mute?: HTMLButtonElement; + pip?: HTMLButtonElement; + play?: HTMLButtonElement | HTMLButtonElement[]; + restart?: HTMLButtonElement; + rewind?: HTMLButtonElement; + settings?: HTMLButtonElement; + }; + captions: HTMLElement | null; + container: HTMLElement | null; + controls: HTMLElement | null; + fullscreen: HTMLElement | null; + wrapper: HTMLElement | null; + } + interface SourceInfo { /** * Note: YouTube and Vimeo are currently not supported as audio sources. |