Aspect ratio tweaks
This commit is contained in:
parent
0f14865d56
commit
97d9228bed
@ -44,8 +44,10 @@ const html5 = {
|
|||||||
|
|
||||||
const player = this;
|
const player = this;
|
||||||
|
|
||||||
// Set aspect ratio if set
|
// Set aspect ratio if fixed
|
||||||
setAspectRatio.call(player);
|
if (!is.empty(this.config.ratio)) {
|
||||||
|
setAspectRatio.call(player);
|
||||||
|
}
|
||||||
|
|
||||||
// Quality
|
// Quality
|
||||||
Object.defineProperty(player.media, 'quality', {
|
Object.defineProperty(player.media, 'quality', {
|
||||||
|
@ -336,8 +336,13 @@ class Listeners {
|
|||||||
on.call(player, elements.container, 'enterfullscreen exitfullscreen', event => {
|
on.call(player, elements.container, 'enterfullscreen exitfullscreen', event => {
|
||||||
const { target, usingNative } = player.fullscreen;
|
const { target, usingNative } = player.fullscreen;
|
||||||
|
|
||||||
// Ignore for iOS native
|
// Ignore events not from target
|
||||||
if (!player.isEmbed || target !== elements.container) {
|
if (target !== elements.container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's not an embed and no ratio specified
|
||||||
|
if (!player.isEmbed && is.empty(player.config.ratio)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,11 +192,8 @@ export function toggleHidden(element, hidden) {
|
|||||||
hide = !element.hidden;
|
hide = !element.hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hide) {
|
// eslint-disable-next-line no-param-reassign
|
||||||
element.setAttribute('hidden', '');
|
element.hidden = hide;
|
||||||
} else {
|
|
||||||
element.removeAttribute('hidden');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mirror Element.classList.toggle, with IE compatibility for "force" argument
|
// Mirror Element.classList.toggle, with IE compatibility for "force" argument
|
||||||
|
@ -27,15 +27,8 @@ export function reduceAspectRatio(ratio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getAspectRatio(input) {
|
export function getAspectRatio(input) {
|
||||||
const parse = ratio => {
|
const parse = ratio => (validateRatio(ratio) ? ratio.split(':').map(Number) : null);
|
||||||
if (!validateRatio(ratio)) {
|
// Try provided ratio
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ratio.split(':').map(Number);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Provided ratio
|
|
||||||
let ratio = parse(input);
|
let ratio = parse(input);
|
||||||
|
|
||||||
// Get from config
|
// Get from config
|
||||||
|
@ -62,12 +62,13 @@
|
|||||||
|
|
||||||
.plyr__video-wrapper {
|
.plyr__video-wrapper {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
position: static;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vimeo requires some different styling
|
// Vimeo requires some different styling
|
||||||
&.plyr--vimeo .plyr__video-wrapper {
|
&.plyr--vimeo .plyr__video-wrapper {
|
||||||
height: 0;
|
height: 0;
|
||||||
|
position: relative;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user