@slashedcloud/player
Version:
A media player application utilizing Shaka Player for adaptive video streaming, capable of playing HLS, MPD and plain HTTP video streams.
7 lines (6 loc) • 1.57 kB
JavaScript
var h=Object.defineProperty;var u=(s,e,t)=>e in s?h(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e,t)=>u(s,typeof e!="symbol"?e+"":e,t);var d=(s,e,t)=>new Promise((p,n)=>{var o=r=>{try{i(t.next(r))}catch(c){n(c)}},a=r=>{try{i(t.throw(r))}catch(c){n(c)}},i=r=>r.done?p(r.value):Promise.resolve(r.value).then(o,a);i((t=t.apply(s,e)).next())});/*!
* 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)
*/this.SlashedCloudPlayer=this.SlashedCloudPlayer||{};this.SlashedCloudPlayer.Poster=function(){"use strict";var s=document.createElement("style");s.textContent=`.shaka-player-poster{height:100%;width:100%;position:absolute;background-repeat:no-repeat;background-size:contain;background-position:center}
`,document.head.appendChild(s);class e{constructor(n){l(this,"player");this.player=n}}class t extends e{constructor(o,a){super(o);l(this,"name","PosterPlugin");l(this,"options");this.options=a}setup(){return d(this,null,function*(){const o=document.createElement("div");o.classList.add("shaka-player-poster"),o.style.backgroundImage=`url(${this.options.poster})`,this.player.container.appendChild(o),this.player.videoElement.poster=this.options.poster;const a=i=>{switch(i){case"seeked":if(this.player.videoElement.currentTime<=0)return;case"play":this.player.container.removeChild(o),this.player.off(["play","seeked"],a);break}};this.player.on(["play","seeked"],a)})}}return t}();