UNPKG

@slashedcloud/player

Version:

A media player application utilizing Shaka Player for adaptive video streaming, capable of playing HLS, MPD and plain HTTP video streams.

53 lines (52 loc) 1.62 kB
import '../Poster.css';var h = Object.defineProperty; var u = (t, s, e) => s in t ? h(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e; var p = (t, s, e) => u(t, typeof s != "symbol" ? s + "" : s, e); var l = (t, s, e) => new Promise((r, a) => { var c = (o) => { try { i(e.next(o)); } catch (n) { a(n); } }, d = (o) => { try { i(e.throw(o)); } catch (n) { a(n); } }, i = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(c, d); i((e = e.apply(t, s)).next()); }); import y from "./Base.js"; /*! * SlashedCloud v0.1.2 (https://github.com/SlashedCloud/player#readme) * Copyright 2024-2024 rogerio.jardim@fedrax.pt * Licensed under Apache (https://github.com/SlashedCloud/player/blob/develop/LICENSE) */ class P extends y { constructor(e, r) { super(e); p(this, "name", "PosterPlugin"); p(this, "options"); this.options = r; } setup() { return l(this, null, function* () { const e = document.createElement("div"); e.classList.add("shaka-player-poster"), e.style.backgroundImage = `url(${this.options.poster})`, this.player.container.appendChild(e), this.player.videoElement.poster = this.options.poster; const r = (a) => { switch (a) { case "seeked": if (this.player.videoElement.currentTime <= 0) return; case "play": this.player.container.removeChild(e), this.player.off(["play", "seeked"], r); break; } }; this.player.on(["play", "seeked"], r); }); } } export { P as default };