@slashedcloud/player
Version:
A media player application utilizing Shaka Player for adaptive video streaming, capable of playing HLS, MPD and plain HTTP video streams.
87 lines (86 loc) • 3.08 kB
JavaScript
var v = Object.defineProperty;
var g = Object.getOwnPropertySymbols;
var x = Object.prototype.hasOwnProperty, P = Object.prototype.propertyIsEnumerable;
var k = (t) => {
throw TypeError(t);
};
var d = (t, s, o) => s in t ? v(t, s, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[s] = o, b = (t, s) => {
for (var o in s || (s = {}))
x.call(s, o) && d(t, o, s[o]);
if (g)
for (var o of g(s))
P.call(s, o) && d(t, o, s[o]);
return t;
};
var f = (t, s, o) => d(t, typeof s != "symbol" ? s + "" : s, o), A = (t, s, o) => s.has(t) || k("Cannot " + o);
var C = (t, s, o) => s.has(t) ? k("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, o);
var p = (t, s, o) => (A(t, s, "access private method"), o);
var y = (t, s, o) => new Promise((e, i) => {
var m = (r) => {
try {
u(o.next(r));
} catch (c) {
i(c);
}
}, B = (r) => {
try {
u(o.throw(r));
} catch (c) {
i(c);
}
}, u = (r) => r.done ? e(r.value) : Promise.resolve(r.value).then(m, B);
u((o = o.apply(t, s)).next());
});
import { i as n, h as l } from "../HexRgb-Bi74b35C.js";
import R 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)
*/
var a, h;
class j extends R {
/**
* Creates an instance of AccentColorFeature.
* @param player - The SlashedCloudPlayer instance.
*/
constructor(o, e) {
super(o);
C(this, a);
f(this, "name", "AccentColorPlugin");
f(this, "options");
this.options = e;
}
/**
* Sets up the AccentColorFeature.
*/
setup() {
return y(this, null, function* () {
const o = b({}, this.player.uiConfig.seekBarColors), e = b({}, this.player.uiConfig.volumeBarColors);
if (this.options.background && n(this.options.background)) {
const i = l(this.options.background);
p(this, a, h).call(this, "--shaka-player-background-color", i);
}
if (this.options.base && n(this.options.base)) {
const i = l(this.options.base, 0.2);
o.base = i, e.base = i;
}
if (this.options.buffered && n(this.options.buffered) && (o.buffered = l(this.options.buffered, 0.54)), this.options.played && n(this.options.played)) {
const i = l(this.options.played);
o.played = i, e.level = i, p(this, a, h).call(this, "--shaka-player-range-thumb-background-color", i), p(this, a, h).call(this, "--shaka-player-hover-color", i);
}
this.options.adBreaks && n(this.options.adBreaks) && (o.adBreaks = l(this.options.adBreaks)), this.player.uiConfig.seekBarColors = o, this.player.uiConfig.volumeBarColors = e;
});
}
}
a = new WeakSet(), /**
* Change the root variable.
* @param property - The name of the CSS property.
* @param value - The value to set for the CSS property.
*/
h = function(o, e) {
document.documentElement.style.setProperty(o, e);
};
export {
j as default
};