Mercurial > code > home > repos > video
view src/VideoSection.ts @ 6:ccfea3625cf6
render thumbs and display them (no video player at all atm)
author | drewp@bigasterisk.com |
---|---|
date | Sun, 09 Apr 2023 18:02:25 -0700 |
parents | c8a41359505c |
children | f80f8c22752d |
line wrap: on
line source
import { LitElement, html, css } from "lit"; import { customElement, property } from "lit/decorators.js"; import "shaka-video-element"; @customElement("video-section") export class VideoSection extends LitElement { @property({ type: String }) manifest: string | undefined; @property({ type: String }) thumbRelPath: string | undefined; @property({ type: String }) title: string = "(unknown)"; @property({ type: String }) big: boolean = false; static styles = [ css` section { background: #ffffff14; display: inline-block; padding: 10px; color: white; width: 300px; } #video.big { z-index: 2; position: fixed; left: 0px; top: 0px; } `, ]; render() { const vidCls = this.big ? "big" : ""; const inx = 20, iny = 50; const inw = 300, inh = 150; const outw = 720, outh = 480; const scl = outh / inh; const tx = (document.body.clientWidth - inw * scl) / 2, ty = (document.body.clientHeight - inh * scl) / 2; const style = this.big ? `transform: translate(${-inx - inw / 2}px,${-iny - inh / 2}px) scale(${outh / inh}) translate(${tx}px,${ty}px);` : ""; return html` <section> <h1>${this.title}</h1> <!-- <shaka-video class="${vidCls}" style="${style}" id="video" width="720" height="480" src="${this.manifest}" controls></video>--> <img src="${this.thumbRelPath}" /> </section> `; } updated() { // const el=this.querySelector("#video") // console.log(el.clientWidth); } }