comparison 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
comparison
equal deleted inserted replaced
5:75b54be050bc 6:ccfea3625cf6
3 import "shaka-video-element"; 3 import "shaka-video-element";
4 4
5 @customElement("video-section") 5 @customElement("video-section")
6 export class VideoSection extends LitElement { 6 export class VideoSection extends LitElement {
7 @property({ type: String }) manifest: string | undefined; 7 @property({ type: String }) manifest: string | undefined;
8 @property({ type: String }) thumbRelPath: string | undefined;
8 @property({ type: String }) title: string = "(unknown)"; 9 @property({ type: String }) title: string = "(unknown)";
9 @property({ type: String }) big: boolean = false; 10 @property({ type: String }) big: boolean = false;
10 11
11 static styles = [ 12 static styles = [
12 css` 13 css`
35 outh = 480; 36 outh = 480;
36 const scl = outh / inh; 37 const scl = outh / inh;
37 const tx = (document.body.clientWidth - inw * scl) / 2, 38 const tx = (document.body.clientWidth - inw * scl) / 2,
38 ty = (document.body.clientHeight - inh * scl) / 2; 39 ty = (document.body.clientHeight - inh * scl) / 2;
39 const style = this.big ? `transform: translate(${-inx - inw / 2}px,${-iny - inh / 2}px) scale(${outh / inh}) translate(${tx}px,${ty}px);` : ""; 40 const style = this.big ? `transform: translate(${-inx - inw / 2}px,${-iny - inh / 2}px) scale(${outh / inh}) translate(${tx}px,${ty}px);` : "";
40 console.log(document.body.clientWidth);
41 return html` 41 return html`
42 <section> 42 <section>
43 <h1>${this.title}</h1> 43 <h1>${this.title}</h1>
44 <shaka-video class="${vidCls}" style="${style}" id="video" width="720" height="480" src="${this.manifest}" controls></video> 44 <!-- <shaka-video class="${vidCls}" style="${style}" id="video" width="720" height="480" src="${this.manifest}" controls></video>-->
45 <img src="${this.thumbRelPath}" />
45 </section> 46 </section>
46 `; 47 `;
47 } 48 }
48 updated() { 49 updated() {
49 // const el=this.querySelector("#video") 50 // const el=this.querySelector("#video")