view src/VideoSection.ts @ 49:1bd17c2e5517 default tip

video.py must sign video urls for serve-files.js to serve them
author drewp@bigasterisk.com
date Fri, 06 Dec 2024 17:13:51 -0800
parents 046673b1cc24
children
line wrap: on
line source

import { LitElement, css, html, unsafeCSS } from "lit";
import { customElement, property } from "lit/decorators.js";
import "shaka-video-element";
import maincss from "./main.css?inline";

@customElement("video-section")
export class VideoSection extends LitElement {
  @property({ type: String }) webRelPath: string | undefined;
  @property({ type: String }) thumbRelPath: string | undefined;
  @property({ type: String }) title: string = "(unknown)";
  @property({ type: String }) big: boolean = false;

  static styles = [
    unsafeCSS(maincss),
    css`
      :host {
        display: inline-block;
      }
    `,
  ];
  render() {
    return html`
      <div class="videoListing" @click=${this.click}>
        <div class="video-title" title="${this.title}">${this.title}</div>
        <span id="imgCrop" style='background-image: url("${this.thumbRelPath}")'></span>
      </div>
    `;
  }
  click() {
    this.dispatchEvent(
      new CustomEvent("playVideo", {
        detail: {
          webRelPath: this.webRelPath,
          zoomFrom: "my location",
        },
      })
    );
  }
}