view src/VideoSection.ts @ 8:f80f8c22752d

start PagePlayer, a singleton player that appears on top
author drewp@bigasterisk.com
date Sun, 09 Apr 2023 19:37:05 -0700
parents ccfea3625cf6
children ff73b95fc72f
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;
      }
    `,
  ];
  render() {
    return html`
      <section @click=${this.click}>
        <h1>${this.title}</h1>
        <img src="${this.thumbRelPath}" />
      </section>
    `;
  }
  click() {
    this.dispatchEvent(
      new CustomEvent("playVideo", {
        detail: {
          manifest: this.manifest,
          zoomFrom: "my location",
        },
      })
    );
  }
  updated() {
    // const  el=this.querySelector("#video")
    // console.log(el.clientWidth);
  }
}