Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
fix: improve sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Apr 2, 2023
1 parent 5d00c77 commit 35420aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
12 changes: 8 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
justify-content: center;
flex-direction: column;
}
jwplayer-video {
aspect-ratio: 16 / 9;
background: #000;
media-controller:not([audio]) {
display: block; /* expands the container if preload=none */
aspect-ratio: 16 / 9; /* set container aspect ratio if preload=none */
width: 100%;
}
media-controller {
jwplayer-video {
display: block;
width: 100%;
aspect-ratio: 16 / 9;
background: #000;
}
</style>

Expand All @@ -36,6 +39,7 @@

<h1>&lt;jwplayer-video&gt;</h1>
<br>

<jwplayer-video
controls
src="https://cdn.jwplayer.com/players/C8YE48zj-IxzuqJ4M.html"
Expand Down
20 changes: 11 additions & 9 deletions jwplayer-video-element.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SuperVideoElement } from 'super-media-element';

const templateLightDOM = document.createElement('template');
templateLightDOM.innerHTML = `
templateLightDOM.innerHTML = /*html*/`
<style class="jw-style">
.jw-no-controls [class*="jw-controls"],
.jw-no-controls .jw-title {
Expand All @@ -12,10 +12,18 @@ templateLightDOM.innerHTML = `
`;

const templateShadowDOM = document.createElement('template');
templateShadowDOM.innerHTML = `
templateShadowDOM.innerHTML = /*html*/`
<style>
:host {
display: inline-block;
min-width: 300px;
min-height: 150px;
position: relative;
}
::slotted(.jwplayer) {
position: absolute !important;
width: 100%;
height: 100%;
}
</style>
<slot></slot>
Expand Down Expand Up @@ -111,13 +119,7 @@ class JWPlayerVideoElement extends SuperVideoElement {

set controls(val) {
if (this.controls == val) return;

if (val) {
this.setAttribute('controls', '');
} else {
// Remove boolean attribute if false, 0, '', null, undefined.
this.removeAttribute('controls');
}
this.toggleAttribute('controls', Boolean(val));
}

get controls() {
Expand Down

1 comment on commit 35420aa

@vercel
Copy link

@vercel vercel bot commented on 35420aa Apr 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.