aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/fullscreen.js6
-rw-r--r--src/js/plugins/vimeo.js2
-rw-r--r--src/js/plyr.d.ts30
-rw-r--r--src/js/plyr.js2
-rw-r--r--src/js/utils/is.js8
5 files changed, 43 insertions, 5 deletions
diff --git a/src/js/fullscreen.js b/src/js/fullscreen.js
index 76acbd06..20e958fc 100644
--- a/src/js/fullscreen.js
+++ b/src/js/fullscreen.js
@@ -256,7 +256,11 @@ class Fullscreen {
// iOS native fullscreen doesn't need the request step
if (browser.isIos && this.player.config.fullscreen.iosNative) {
- this.target.webkitEnterFullscreen();
+ if (this.player.isVimeo) {
+ this.player.embed.requestFullscreen();
+ } else {
+ this.target.webkitEnterFullscreen();
+ }
} else if (!Fullscreen.native || this.forceFallback) {
this.toggleFallback(true);
} else if (!this.prefix) {
diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js
index b050cc53..5fe41aba 100644
--- a/src/js/plugins/vimeo.js
+++ b/src/js/plugins/vimeo.js
@@ -104,7 +104,7 @@ const vimeo = {
const src = format(player.config.urls.vimeo.iframe, id, params);
iframe.setAttribute('src', src);
iframe.setAttribute('allowfullscreen', '');
- iframe.setAttribute('allow', 'autoplay,fullscreen,picture-in-picture');
+ iframe.setAttribute('allow', ['autoplay', 'fullscreen', 'picture-in-picture'].join('; '));
// Set the referrer policy if required
if (!is.empty(referrerPolicy)) {
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.
diff --git a/src/js/plyr.js b/src/js/plyr.js
index b37893bc..e67e29d4 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -206,7 +206,7 @@ class Plyr {
}
// Unsupported or missing provider
- if (is.empty(this.provider) || !Object.keys(providers).includes(this.provider)) {
+ if (is.empty(this.provider) || !Object.values(providers).includes(this.provider)) {
this.debug.error('Setup failed: Invalid provider');
return;
}
diff --git a/src/js/utils/is.js b/src/js/utils/is.js
index 3bb50a00..5a60da06 100644
--- a/src/js/utils/is.js
+++ b/src/js/utils/is.js
@@ -13,7 +13,6 @@ const isFunction = (input) => getConstructor(input) === Function;
const isArray = (input) => Array.isArray(input);
const isWeakMap = (input) => instanceOf(input, WeakMap);
const isNodeList = (input) => instanceOf(input, NodeList);
-const isElement = (input) => instanceOf(input, Element);
const isTextNode = (input) => getConstructor(input) === Text;
const isEvent = (input) => instanceOf(input, Event);
const isKeyboardEvent = (input) => instanceOf(input, KeyboardEvent);
@@ -21,6 +20,13 @@ const isCue = (input) => instanceOf(input, window.TextTrackCue) || instanceOf(in
const isTrack = (input) => instanceOf(input, TextTrack) || (!isNullOrUndefined(input) && isString(input.kind));
const isPromise = (input) => instanceOf(input, Promise) && isFunction(input.then);
+const isElement = (input) =>
+ input !== null &&
+ (typeof input === "object") &&
+ (input.nodeType === 1) &&
+ (typeof input.style === "object") &&
+ (typeof input.ownerDocument === "object");
+
const isEmpty = (input) =>
isNullOrUndefined(input) ||
((isString(input) || isArray(input) || isNodeList(input)) && !input.length) ||