@slashedcloud/player
Version:
A media player application utilizing Shaka Player for adaptive video streaming, capable of playing HLS, MPD and plain HTTP video streams.
6 lines (5 loc) • 2.9 kB
JavaScript
var O=Object.defineProperty;var R=t=>{throw TypeError(t)};var P=(t,e,r)=>e in t?O(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var c=(t,e,r)=>P(t,typeof e!="symbol"?e+"":e,r),b=(t,e,r)=>e.has(t)||R("Cannot "+r);var p=(t,e,r)=>e.has(t)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var m=(t,e,r)=>(b(t,e,"access private method"),r);var g=(t,e,r)=>new Promise((u,d)=>{var l=a=>{try{s(r.next(a))}catch(i){d(i)}},I=a=>{try{s(r.throw(a))}catch(i){d(i)}},s=a=>a.done?u(a.value):Promise.resolve(a.value).then(l,I);s((r=r.apply(t,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.PixelTag=function(){"use strict";var l,y;class t{constructor(a){c(this,"player");this.player=a}}const e=s=>Object.prototype.toString.call(s)==="[object Object]";var r=(s=>(s[s.INFO=0]="INFO",s[s.WARNING=1]="WARNING",s[s.ERROR=2]="ERROR",s[s.CRITICAL=3]="CRITICAL",s[s.FATAL=4]="FATAL",s))(r||{});class u extends Error{constructor(i,o,h,n){super(h);p(this,l);c(this,"name");c(this,"message");c(this,"severity");c(this,"code");c(this,"description");c(this,"reason");this.name=i,this.message=h,this.severity=o,this.code=n==null?void 0:n.code,this.description=n==null?void 0:n.description,this.reason=n==null?void 0:n.reason,m(this,l,y).call(this)}get severityString(){switch(this.severity){case 3:return"CRITICAL";case 2:return"ERROR";case 1:return"WARNING";case 0:default:return"INFO"}}toObject(){return{errorName:this.name,errorMessage:this.message,errorSeverity:this.severityString,errorCode:this.code,errorDescription:this.description,errorReason:this.reason}}}l=new WeakSet,y=function(){var o,h,n;let i=`${this.severityString}: ${this.name} | ${this.message}`;switch(this.description&&(i+=` | ${this.description}`),this.code&&(i+=` [${this.code}]`),this.severity){case 0:console.info(i,(o=this.reason)!=null?o:"");break;case 1:console.warn(i,(h=this.reason)!=null?h:"");break;case 2:case 3:case 4:default:console.error(i,(n=this.reason)!=null?n:"");break}};class d extends t{constructor(i,o){super(i);c(this,"name","PixelTagPlugin");c(this,"options");this.options=o}setup(){return g(this,null,function*(){if(!this.options||!e(this.options))throw new u(this.name,r.ERROR,"The options are missing or not clearly defined.",{description:"Provide the necessary options to complete the setup process."});const i=Object.keys(this.options);this.player.on(i,o=>{const h=this.options[o];this.sendEvent(o,h)})})}sendEvent(i,o){return g(this,null,function*(){var h=new Image;h.src=o,this.player.options.debug&&(console.log("======= Pixel Tag Event debug ======="),console.log("Event sent:",i))})}}return d}();