@slashedcloud/player
Version:
A media player application utilizing Shaka Player for adaptive video streaming, capable of playing HLS, MPD and plain HTTP video streams.
60 lines (59 loc) • 1.81 kB
JavaScript
var h = Object.defineProperty;
var y = (s, t, e) => t in s ? h(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
var p = (s, t, e) => y(s, typeof t != "symbol" ? t + "" : t, e);
var o = (s, t, e) => new Promise((u, a) => {
var l = (r) => {
try {
m(e.next(r));
} catch (i) {
a(i);
}
}, n = (r) => {
try {
m(e.throw(r));
} catch (i) {
a(i);
}
}, m = (r) => r.done ? u(r.value) : Promise.resolve(r.value).then(l, n);
m((e = e.apply(s, t)).next());
});
import c 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 g extends c {
constructor(e) {
super(e);
p(this, "name", "Volume");
}
/**
* Get the volume from the persister and set it on the player
* Get the muted state from the persister and set it on the player
* Set the volume and muted state on the player when the volume changes
*/
setup() {
return o(this, null, function* () {
const e = this.player.persister.get("muted"), u = this.player.persister.get("volume");
this.player.once("ready", () => {
e ? this.player.mute() : this.player.unmute(), u && this.player.volume(u);
}), this.player.on(["unmute", "mute", "volumeChange"], (a, l) => {
switch (a) {
case "unmute":
this.player.persister.set("muted", !1);
break;
case "mute":
this.player.persister.set("muted", !0);
break;
case "volumeChange":
this.player.persister.set("volume", l.volume);
break;
}
});
});
}
}
export {
g as default
};