import { WiredBase, BaseCSS, Point } from './wired-base'; import { rectangle } from './wired-lib'; import { css, TemplateResult, html, CSSResultArray } from 'lit'; import { customElement, property, query } from 'lit/decorators.js'; import { WiredProgress } from './wired-progress.js'; import { WiredSlider } from './wired-slider'; import './wired-icon-button.js'; @customElement('wired-video') export class WiredVideo extends WiredBase { @property({ type: String }) src = ''; @property({ type: Boolean }) autoplay = false; @property({ type: Boolean }) loop = false; @property({ type: Boolean }) muted = false; @property({ type: Boolean }) playsinline = false; @property() private playing = false; @property() private timeDisplay = ''; @query('wired-progress') private progressBar?: WiredProgress; @query('wired-slider') private slider?: WiredSlider; @query('video') private video?: HTMLVideoElement; private resizeObserver?: ResizeObserver; private windowResizeHandler?: EventListenerOrEventListenerObject; constructor() { super(); if ((window as any).ResizeObserver) { this.resizeObserver = new (window as any).ResizeObserver(() => { if (this.svg) { this.wiredRender(); } }); } } static get styles(): CSSResultArray { return [ BaseCSS, css` :host { display: inline-block; position: relative; line-height: 1; padding: 3px 3px 68px; --wired-progress-color: var(--wired-video-highlight-color, rgb(51, 103, 214)); --wired-slider-knob-color: var(--wired-video-highlight-color, rgb(51, 103, 214)); } video { display: block; box-sizing: border-box; max-width: 100%; max-height: 100%; } path { stroke-width: 1; } #controls { position: absolute; pointer-events: auto; left: 0; bottom: 0; width: 100%; box-sizing: border-box; height: 70px; } .layout.horizontal { display: -ms-flexbox; display: -webkit-flex; display: flex; -ms-flex-direction: row; -webkit-flex-direction: row; flex-direction: row; -ms-flex-align: center; -webkit-align-items: center; align-items: center; padding: 5px 10px; } .flex { -ms-flex: 1 1 0.000000001px; -webkit-flex: 1; flex: 1; -webkit-flex-basis: 0.000000001px; flex-basis: 0.000000001px; } wired-progress { display: block; width: 100%; box-sizing: border-box; height: 20px; --wired-progress-label-color: transparent; --wired-progress-label-background: transparent; } wired-icon-button span { font-size: 16px; line-height: 16px; width: 16px; height: 16px; padding: 0px; font-family: sans-serif; display: inline-block; } #timeDisplay { padding: 0 20px 0 8px; font-size: 13px; } wired-slider { display: block; max-width: 200px; margin: 0 6px 0 auto; } ` ]; } render(): TemplateResult { return html`