@vindral/web-sdk 4.2.0-5-g7d2f2421 → 4.2.0-7-g7d6ca07f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/1vibAwcB.js +143 -0
- package/BjFDlUkI.js +59 -0
- package/CO2zGlac.js +166 -0
- package/CgCFv2k5.js +208 -0
- package/CnCQ_flD.js +4492 -0
- package/CodtCCWB.js +13 -0
- package/D4BVrOMF.js +11198 -0
- package/DTteQSVE.js +65 -0
- package/Dexfb10F.js +25 -0
- package/DpGTMfRs.js +146 -0
- package/Dps-VoAh.js +18624 -0
- package/DqtwD92q.js +268 -0
- package/R2vG6-bP.js +50 -0
- package/api-client.js +2 -4
- package/cast-sender.js +2 -230
- package/core.js +3 -13
- package/legacy.es.js +13302 -15265
- package/legacy.umd.js +1147 -15
- package/package.json +1 -1
- package/player.js +3 -5476
- package/react.js +0 -1
- package/vindral-player-component.js +5 -2
- package/zjSBNbgC.js +118 -0
- package/BlaVT4GS.js +0 -232
- package/CeNTkfvl.js +0 -206
- package/CuhQLT-7.js +0 -254
- package/DGo74EDo.js +0 -59
- package/DUiPjZzG.js +0 -13187
- package/DbI5whml.js +0 -312
- package/h5LA1Y1W.js +0 -21750
package/CeNTkfvl.js
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
var k = Object.defineProperty, I = Object.defineProperties;
|
|
2
|
-
var T = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var w = Object.getOwnPropertySymbols;
|
|
4
|
-
var M = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var S = (s, e, t) => e in s ? k(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, b = (s, e) => {
|
|
6
|
-
for (var t in e || (e = {}))
|
|
7
|
-
M.call(e, t) && S(s, t, e[t]);
|
|
8
|
-
if (w)
|
|
9
|
-
for (var t of w(e))
|
|
10
|
-
C.call(e, t) && S(s, t, e[t]);
|
|
11
|
-
return s;
|
|
12
|
-
}, y = (s, e) => I(s, T(e));
|
|
13
|
-
var i = (s, e, t) => S(s, typeof e != "symbol" ? e + "" : e, t);
|
|
14
|
-
var v = (s, e, t) => new Promise((r, n) => {
|
|
15
|
-
var a = (o) => {
|
|
16
|
-
try {
|
|
17
|
-
c(t.next(o));
|
|
18
|
-
} catch (d) {
|
|
19
|
-
n(d);
|
|
20
|
-
}
|
|
21
|
-
}, l = (o) => {
|
|
22
|
-
try {
|
|
23
|
-
c(t.throw(o));
|
|
24
|
-
} catch (d) {
|
|
25
|
-
n(d);
|
|
26
|
-
}
|
|
27
|
-
}, c = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(a, l);
|
|
28
|
-
c((t = t.apply(s, e)).next());
|
|
29
|
-
});
|
|
30
|
-
import { F as D, a as q, b as R, c as O } from "./DUiPjZzG.js";
|
|
31
|
-
class E {
|
|
32
|
-
constructor() {
|
|
33
|
-
i(this, "map", /* @__PURE__ */ new Map());
|
|
34
|
-
}
|
|
35
|
-
enqueue(e, t) {
|
|
36
|
-
const r = this.map.get(e);
|
|
37
|
-
r ? r.push(t) : this.map.set(e, [t]);
|
|
38
|
-
}
|
|
39
|
-
dequeue(e) {
|
|
40
|
-
const t = this.map.get(e);
|
|
41
|
-
if (t && t.length > 0) {
|
|
42
|
-
const r = t.shift();
|
|
43
|
-
return t.length === 0 && this.map.delete(e), r;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Dequeue by exact timestamp, falling back to the oldest pending entry
|
|
48
|
-
* when the decoder outputs a timestamp that differs from input.
|
|
49
|
-
*
|
|
50
|
-
* Safe for audio because all audio frames are independently decodable
|
|
51
|
-
* key frames — there's no B-frame reordering that could cause metadata
|
|
52
|
-
* mismatches like in video.
|
|
53
|
-
*/
|
|
54
|
-
dequeueWithFallback(e) {
|
|
55
|
-
const t = this.dequeue(e);
|
|
56
|
-
if (t !== void 0) return t;
|
|
57
|
-
for (const [r, n] of this.map)
|
|
58
|
-
if (n.length > 0) {
|
|
59
|
-
const a = n.shift();
|
|
60
|
-
return n.length === 0 && this.map.delete(r), a;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
removeLast(e) {
|
|
64
|
-
const t = this.map.get(e);
|
|
65
|
-
!t || t.length === 0 || (t.pop(), t.length === 0 && this.map.delete(e));
|
|
66
|
-
}
|
|
67
|
-
clear() {
|
|
68
|
-
this.map.clear();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const $ = globalThis, u = class u {
|
|
72
|
-
constructor(e) {
|
|
73
|
-
i(this, "decodedSamples", []);
|
|
74
|
-
i(this, "decoder", null);
|
|
75
|
-
i(this, "logger");
|
|
76
|
-
i(this, "initSegments", /* @__PURE__ */ new Map());
|
|
77
|
-
i(this, "previousSample");
|
|
78
|
-
i(this, "previousCodec");
|
|
79
|
-
i(this, "pendingSamples", new E());
|
|
80
|
-
i(this, "errors", new D(10));
|
|
81
|
-
i(this, "resetDecoderState", () => {
|
|
82
|
-
this.pendingSamples.clear(), this.previousSample = void 0, this.previousCodec = void 0;
|
|
83
|
-
});
|
|
84
|
-
i(this, "ensureDecoder", () => ((!this.decoder || this.decoder.state === "closed") && (this.decoder = this.createDecoder()), this.decoder));
|
|
85
|
-
i(this, "createDecoder", () => new AudioDecoder({
|
|
86
|
-
output: (e) => {
|
|
87
|
-
const t = this.pendingSamples.dequeueWithFallback(e.timestamp);
|
|
88
|
-
if (!t) {
|
|
89
|
-
e.close();
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const { sample: r, decodeStartTime: n } = t;
|
|
93
|
-
try {
|
|
94
|
-
const a = e.numberOfFrames, l = e.numberOfChannels, c = e.sampleRate, o = e.timestamp, d = e.duration, p = new Float32Array(a * l);
|
|
95
|
-
e.copyTo(p, { planeIndex: 0, format: "f32" });
|
|
96
|
-
const h = Math.round(o * r.timescale / 1e6), f = typeof d == "number" && Number.isFinite(d) ? Math.max(0, Math.round(d * r.timescale / 1e6)) : r.duration, g = y(b({}, r), {
|
|
97
|
-
timestamp: h,
|
|
98
|
-
duration: f,
|
|
99
|
-
type: "audio",
|
|
100
|
-
format: "f32",
|
|
101
|
-
data: p,
|
|
102
|
-
sampleRate: c,
|
|
103
|
-
channels: l,
|
|
104
|
-
statistics: {
|
|
105
|
-
decodeTime: Math.max(performance.now() - n, 0),
|
|
106
|
-
transportTimeFromWorker: 0,
|
|
107
|
-
transportTimeToWorker: 0,
|
|
108
|
-
samplesInBatch: 1
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
this.decodedSamples.push(g);
|
|
112
|
-
} finally {
|
|
113
|
-
e.close();
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
error: (e) => {
|
|
117
|
-
this.logger.error("Decoder error:", e.name, e.message), this.resetDecoderState(), this.errors.push(e);
|
|
118
|
-
}
|
|
119
|
-
}));
|
|
120
|
-
/**
|
|
121
|
-
* Build AudioDecoderConfig codec string from audio codec type.
|
|
122
|
-
*/
|
|
123
|
-
i(this, "buildCodecString", q);
|
|
124
|
-
/**
|
|
125
|
-
* Get the description for AudioDecoderConfig.
|
|
126
|
-
* Uses init segment data if available, otherwise generates codec-specific description.
|
|
127
|
-
*/
|
|
128
|
-
i(this, "getDescription", (e, t) => {
|
|
129
|
-
const r = this.initSegments.get(t.renditionId);
|
|
130
|
-
if (r && r.data.byteLength > 0 && r.codec === e)
|
|
131
|
-
return r.data;
|
|
132
|
-
if (e === "opus")
|
|
133
|
-
return R(t.channels, t.sampleRate);
|
|
134
|
-
if (e === "aac")
|
|
135
|
-
return O(t.channels, t.sampleRate);
|
|
136
|
-
});
|
|
137
|
-
i(this, "unload", () => {
|
|
138
|
-
this.decodedSamples = [], this.resetDecoderState(), this.decoder && this.decoder.state !== "closed" && this.decoder.close(), this.decoder = null;
|
|
139
|
-
});
|
|
140
|
-
i(this, "initSegment", (e) => {
|
|
141
|
-
this.initSegments.set(e.renditionId, e);
|
|
142
|
-
});
|
|
143
|
-
i(this, "enqueue", (e) => {
|
|
144
|
-
var d, p;
|
|
145
|
-
const t = this.ensureDecoder(), r = e.codec, n = ((d = this.previousSample) == null ? void 0 : d.channelId) !== e.channelId, a = ((p = this.previousSample) == null ? void 0 : p.renditionId) !== e.renditionId, l = this.previousCodec !== r;
|
|
146
|
-
if (!this.previousSample || n || a || l) {
|
|
147
|
-
this.previousSample && t.state === "configured" && t.flush().catch((m) => {
|
|
148
|
-
this.logger.warn("Failed to flush before reconfiguration:", m);
|
|
149
|
-
});
|
|
150
|
-
const h = this.buildCodecString(r), f = this.getDescription(r, e), g = {
|
|
151
|
-
codec: h,
|
|
152
|
-
sampleRate: e.sampleRate,
|
|
153
|
-
numberOfChannels: e.channels,
|
|
154
|
-
description: f
|
|
155
|
-
};
|
|
156
|
-
try {
|
|
157
|
-
t.configure(g), this.previousCodec = r;
|
|
158
|
-
} catch (m) {
|
|
159
|
-
this.logger.error(
|
|
160
|
-
`Failed to configure decoder for ${r} (rendition ${e.renditionId}), dropping sample`,
|
|
161
|
-
m
|
|
162
|
-
), this.errors.push(m instanceof Error ? m : new Error(`Failed to configure decoder for ${r}`)), this.resetDecoderState(), this.ensureDecoder();
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (e.timescale <= 0) {
|
|
167
|
-
this.logger.error(`Invalid timescale ${e.timescale} in sample, dropping sample`);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
this.previousSample = e;
|
|
171
|
-
const c = Math.floor(1e6 * e.timestamp / e.timescale), o = Math.floor(1e6 * e.duration / e.timescale);
|
|
172
|
-
try {
|
|
173
|
-
const h = new EncodedAudioChunk({
|
|
174
|
-
// Audio codecs (Opus, AAC, MP3) always produce independently decodable frames
|
|
175
|
-
type: "key",
|
|
176
|
-
timestamp: c,
|
|
177
|
-
duration: o > 0 ? o : void 0,
|
|
178
|
-
data: e.data
|
|
179
|
-
});
|
|
180
|
-
this.pendingSamples.enqueue(c, { sample: e, decodeStartTime: performance.now() }), t.decode(h);
|
|
181
|
-
} catch (h) {
|
|
182
|
-
this.logger.error("Failed to decode chunk:", h), this.pendingSamples.removeLast(c), t.state === "closed" && (this.resetDecoderState(), this.ensureDecoder());
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
i(this, "flush", () => v(this, null, function* () {
|
|
186
|
-
if (this.decoder && this.decoder.state === "configured")
|
|
187
|
-
try {
|
|
188
|
-
yield this.decoder.flush();
|
|
189
|
-
} catch (e) {
|
|
190
|
-
this.logger.error("Failed to flush decoder:", e), this.resetDecoderState();
|
|
191
|
-
}
|
|
192
|
-
}));
|
|
193
|
-
i(this, "error", () => this.errors.pop());
|
|
194
|
-
i(this, "take", () => this.decodedSamples.shift());
|
|
195
|
-
this.logger = e, this.decoder = this.createDecoder();
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
i(u, "isSupported", () => typeof $.AudioDecoder != "undefined"), i(u, "create", (e) => v(null, null, function* () {
|
|
199
|
-
if (!u.isSupported())
|
|
200
|
-
throw new Error("WebCodecs AudioDecoder is not supported in this environment");
|
|
201
|
-
return new u(e);
|
|
202
|
-
}));
|
|
203
|
-
let F = u;
|
|
204
|
-
export {
|
|
205
|
-
F as WebCodecsAudioDecoderContext
|
|
206
|
-
};
|
package/CuhQLT-7.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
var C = Object.defineProperty, R = Object.defineProperties;
|
|
2
|
-
var q = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var b = Object.getOwnPropertySymbols;
|
|
4
|
-
var A = Object.prototype.hasOwnProperty, O = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var w = (e, t, n) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, u = (e, t) => {
|
|
6
|
-
for (var n in t || (t = {}))
|
|
7
|
-
A.call(t, n) && w(e, n, t[n]);
|
|
8
|
-
if (b)
|
|
9
|
-
for (var n of b(t))
|
|
10
|
-
O.call(t, n) && w(e, n, t[n]);
|
|
11
|
-
return e;
|
|
12
|
-
}, g = (e, t) => R(e, q(t));
|
|
13
|
-
var d = (e, t, n) => w(e, typeof t != "symbol" ? t + "" : t, n);
|
|
14
|
-
var l = (e, t, n) => new Promise((r, s) => {
|
|
15
|
-
var a = (o) => {
|
|
16
|
-
try {
|
|
17
|
-
i(n.next(o));
|
|
18
|
-
} catch (h) {
|
|
19
|
-
s(h);
|
|
20
|
-
}
|
|
21
|
-
}, c = (o) => {
|
|
22
|
-
try {
|
|
23
|
-
i(n.throw(o));
|
|
24
|
-
} catch (h) {
|
|
25
|
-
s(h);
|
|
26
|
-
}
|
|
27
|
-
}, i = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(a, c);
|
|
28
|
-
i((n = n.apply(e, t)).next());
|
|
29
|
-
});
|
|
30
|
-
function f(e, t) {
|
|
31
|
-
if (!e)
|
|
32
|
-
throw new Error(t);
|
|
33
|
-
}
|
|
34
|
-
const P = (e) => {
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(e);
|
|
37
|
-
} catch (t) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
}, y = (e) => {
|
|
41
|
-
switch (e) {
|
|
42
|
-
case "h264":
|
|
43
|
-
case "av1":
|
|
44
|
-
return "video";
|
|
45
|
-
case "aac":
|
|
46
|
-
case "opus":
|
|
47
|
-
case "mp3":
|
|
48
|
-
return "audio";
|
|
49
|
-
case "webvtt":
|
|
50
|
-
return "text";
|
|
51
|
-
default:
|
|
52
|
-
throw new Error("Unknown codec");
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
function U(e) {
|
|
56
|
-
if (e.startsWith("opus"))
|
|
57
|
-
return "opus";
|
|
58
|
-
if (e.startsWith("mp4a"))
|
|
59
|
-
return "aac";
|
|
60
|
-
if (e.startsWith("avc1"))
|
|
61
|
-
return "h264";
|
|
62
|
-
if (e.startsWith("av01"))
|
|
63
|
-
return "av1";
|
|
64
|
-
if (e.startsWith("webvtt"))
|
|
65
|
-
return "webvtt";
|
|
66
|
-
}
|
|
67
|
-
function J(e) {
|
|
68
|
-
return !(typeof e.edges[0] == "string" || e.channels[0] && !("catalog" in e.channels[0]));
|
|
69
|
-
}
|
|
70
|
-
function j(e) {
|
|
71
|
-
return e.tracks.filter((t) => !!t.codec).filter((t) => U(t.codec || "")).map((t, n) => {
|
|
72
|
-
const r = t.codec, s = t.bitrate;
|
|
73
|
-
f(r, "codec is required"), f(s !== void 0, "bitrate is required");
|
|
74
|
-
const a = U(r);
|
|
75
|
-
if (f(a, "codec is required"), y(a) === "audio") {
|
|
76
|
-
const c = t.samplerate || 0, i = t.channelConfig === "stereo" ? 2 : 1;
|
|
77
|
-
return {
|
|
78
|
-
track: t,
|
|
79
|
-
id: n,
|
|
80
|
-
codec: a,
|
|
81
|
-
codecString: r,
|
|
82
|
-
bitRate: s,
|
|
83
|
-
channels: i,
|
|
84
|
-
sampleRate: c,
|
|
85
|
-
language: t.language
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
return y(a) === "text" ? {
|
|
89
|
-
track: t,
|
|
90
|
-
id: n,
|
|
91
|
-
bitRate: 0,
|
|
92
|
-
codec: a,
|
|
93
|
-
kind: "subtitles",
|
|
94
|
-
codecString: r,
|
|
95
|
-
label: t.label,
|
|
96
|
-
language: t.language
|
|
97
|
-
} : (f(t.width, "width is required"), f(t.height, "width is required"), f(t.framerate, "framerate is required"), {
|
|
98
|
-
track: t,
|
|
99
|
-
id: n,
|
|
100
|
-
codec: a,
|
|
101
|
-
bitRate: s,
|
|
102
|
-
codecString: r,
|
|
103
|
-
width: t.width,
|
|
104
|
-
height: t.height,
|
|
105
|
-
frameRate: t.framerate
|
|
106
|
-
});
|
|
107
|
-
}).sort((t, n) => t.bitRate - n.bitRate);
|
|
108
|
-
}
|
|
109
|
-
const L = (e) => e ? {
|
|
110
|
-
Authorization: `Bearer ${e}`
|
|
111
|
-
} : void 0, G = (e, t) => {
|
|
112
|
-
try {
|
|
113
|
-
const n = e.ancestorOrigins;
|
|
114
|
-
if (n && n.length > 0)
|
|
115
|
-
return Array.from(n).join(",") || void 0;
|
|
116
|
-
} catch (n) {
|
|
117
|
-
}
|
|
118
|
-
try {
|
|
119
|
-
if (t.referrer)
|
|
120
|
-
return new URL(t.referrer).origin || void 0;
|
|
121
|
-
} catch (n) {
|
|
122
|
-
}
|
|
123
|
-
}, E = (e) => typeof e == "object" && e !== null && "message" in e;
|
|
124
|
-
class H extends Error {
|
|
125
|
-
constructor({ status: n, url: r, body: s }) {
|
|
126
|
-
const a = P(s), c = E(a) ? a.message : `Url ${r.toString()}, Status code: ${n}, Body: ${s}`;
|
|
127
|
-
super(c);
|
|
128
|
-
d(this, "status");
|
|
129
|
-
d(this, "body");
|
|
130
|
-
d(this, "url");
|
|
131
|
-
this.status = n, this.body = s, this.url = r, Object.setPrototypeOf(this, new.target.prototype);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const M = (e) => typeof e.status == "number", S = () => {
|
|
135
|
-
if (!(typeof window == "undefined" || typeof document == "undefined"))
|
|
136
|
-
return G(window.location, document);
|
|
137
|
-
}, T = (e) => {
|
|
138
|
-
const t = S();
|
|
139
|
-
if (!t || e.searchParams.has("parentOrigin"))
|
|
140
|
-
return e;
|
|
141
|
-
const n = new URL(e.toString());
|
|
142
|
-
return n.searchParams.append("parentOrigin", t), n;
|
|
143
|
-
}, $ = (e, t) => l(null, null, function* () {
|
|
144
|
-
const n = T(e), r = yield fetch(n.toString(), u({ mode: "cors" }, t));
|
|
145
|
-
if (!r.ok)
|
|
146
|
-
throw new H({ status: r.status, url: n, body: yield r.text() });
|
|
147
|
-
return r;
|
|
148
|
-
}), m = (e, t) => l(null, null, function* () {
|
|
149
|
-
return yield (yield $(e, u({}, t))).json();
|
|
150
|
-
}), z = (e, t) => l(null, null, function* () {
|
|
151
|
-
return $(e, u({ method: "POST" }, t));
|
|
152
|
-
});
|
|
153
|
-
function W(e) {
|
|
154
|
-
var t;
|
|
155
|
-
return !(typeof e.edges[0] == "string" || e.channels[0] && "catalog" in e.channels[0] && typeof ((t = e.channels[0]) == null ? void 0 : t.catalog) == "undefined");
|
|
156
|
-
}
|
|
157
|
-
const I = {
|
|
158
|
-
lbConnect: (e) => e.channelGroupId ? `connect?channelId=${e.channelId}&channelGroupId=${e.channelGroupId}` : `connect?channelId=${e.channelId}`,
|
|
159
|
-
thumbnails: (e, t) => t ? e.channelGroupId ? `thumbnail/?channelGroupId=${e.channelGroupId}&auth.token=${t}&auth.type=jwt` : e.channelId ? `thumbnail/?channelId=${e.channelId}&auth.token=${t}&auth.type=jwt` : "thumbnail" : "thumbnail"
|
|
160
|
-
};
|
|
161
|
-
class N {
|
|
162
|
-
constructor(t) {
|
|
163
|
-
d(this, "baseUrl");
|
|
164
|
-
d(this, "tokenFactory");
|
|
165
|
-
this.baseUrl = new URL("/api/v4/", t.publicEndpoint).toString(), this.tokenFactory = t.tokenFactory;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* @ignore
|
|
169
|
-
* Returns everything needed to setup the connection of Vindral instance.
|
|
170
|
-
*/
|
|
171
|
-
connect(t) {
|
|
172
|
-
return l(this, null, function* () {
|
|
173
|
-
const { channelId: n, channelGroupId: r } = t, s = { channelId: n, channelGroupId: r }, a = new URL(I.lbConnect(t), this.baseUrl), c = this.getAuthToken(s), i = yield m(a, { headers: this.getHeaders(c) });
|
|
174
|
-
if (W(i)) {
|
|
175
|
-
const o = i.channels.map((h) => {
|
|
176
|
-
const p = this.toChannel(h, s), v = j(h.catalog);
|
|
177
|
-
return g(u(u({}, h), p), { renditions: v });
|
|
178
|
-
});
|
|
179
|
-
return g(u({}, i), { channels: o });
|
|
180
|
-
} else {
|
|
181
|
-
const o = i.channels.map((h) => {
|
|
182
|
-
const p = this.toChannel(h, s);
|
|
183
|
-
return u(u({}, h), p);
|
|
184
|
-
});
|
|
185
|
-
return g(u({}, i), { channels: o });
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Fetches information regarding a single channel.
|
|
191
|
-
*
|
|
192
|
-
* @param channelId the channel to fetch
|
|
193
|
-
* @returns a [[Channel]] containing information about the requested channel.
|
|
194
|
-
*/
|
|
195
|
-
getChannel(t) {
|
|
196
|
-
return l(this, null, function* () {
|
|
197
|
-
const n = { channelId: t }, r = new URL(`channel/${t}`, this.baseUrl), s = this.getAuthToken(n), a = yield m(r, { headers: this.getHeaders(s) });
|
|
198
|
-
return this.toChannel(a, n, s);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Fetches channels within a channel group
|
|
203
|
-
*
|
|
204
|
-
* Note: The returned list includes inactive channels - check isLive to filter out only active channels
|
|
205
|
-
*
|
|
206
|
-
* @param channelGroupId the channel group to fetch channels from
|
|
207
|
-
* @returns an array of [[Channel]] that belong to the channel group
|
|
208
|
-
*/
|
|
209
|
-
getChannels(t) {
|
|
210
|
-
return l(this, null, function* () {
|
|
211
|
-
const n = { channelGroupId: t }, r = new URL(`channels/${t}`, this.baseUrl), s = this.getAuthToken(n), a = yield m(r, {
|
|
212
|
-
headers: this.getHeaders(s)
|
|
213
|
-
}), c = Array.isArray(a) ? a : a.channels;
|
|
214
|
-
return this.toChannels(c, n, s);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
getHeaders(t) {
|
|
218
|
-
var r;
|
|
219
|
-
return (r = L(t)) != null ? r : {};
|
|
220
|
-
}
|
|
221
|
-
getAuthToken(t) {
|
|
222
|
-
return this.tokenFactory ? this.tokenFactory(t) : void 0;
|
|
223
|
-
}
|
|
224
|
-
toChannels(t, n, r) {
|
|
225
|
-
return t.map((s) => this.toChannel(s, n, r));
|
|
226
|
-
}
|
|
227
|
-
toChannel(t, n, r) {
|
|
228
|
-
const { baseUrl: s, sizes: a } = t.thumbnail, c = s || new URL(I.thumbnails(n, r), this.baseUrl), i = a.map((o) => new URL(
|
|
229
|
-
`?channelId=${t.channelId}&width=${o.width}&height=${o.height}${F(
|
|
230
|
-
n,
|
|
231
|
-
r
|
|
232
|
-
)}`,
|
|
233
|
-
c
|
|
234
|
-
).toString());
|
|
235
|
-
return {
|
|
236
|
-
channelId: t.channelId,
|
|
237
|
-
name: t.name,
|
|
238
|
-
isLive: t.isLive,
|
|
239
|
-
thumbnailUrls: i
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
const F = (e, t) => t ? e.channelGroupId ? `&channelGroupId=${e.channelGroupId}&auth.token=${t}&auth.type=jwt` : `&auth.token=${t}&auth.type=jwt` : "";
|
|
244
|
-
export {
|
|
245
|
-
N as A,
|
|
246
|
-
f as a,
|
|
247
|
-
j as b,
|
|
248
|
-
U as c,
|
|
249
|
-
M as d,
|
|
250
|
-
y as e,
|
|
251
|
-
J as i,
|
|
252
|
-
z as p,
|
|
253
|
-
P as t
|
|
254
|
-
};
|
package/DGo74EDo.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var c = Object.defineProperty;
|
|
2
|
-
var d = (l, s, e) => s in l ? c(l, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[s] = e;
|
|
3
|
-
var o = (l, s, e) => d(l, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
class u {
|
|
5
|
-
constructor() {
|
|
6
|
-
o(this, "listeners", {});
|
|
7
|
-
}
|
|
8
|
-
emit(s, e) {
|
|
9
|
-
const i = this.listeners[s];
|
|
10
|
-
if (i) {
|
|
11
|
-
let r = !1;
|
|
12
|
-
for (let t = 0; t < i.length; t++)
|
|
13
|
-
if (i[t].once) {
|
|
14
|
-
r = !0;
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
r && (this.listeners[s] = i.filter((t) => !t.once));
|
|
18
|
-
let n;
|
|
19
|
-
const h = i.length;
|
|
20
|
-
for (let t = 0; t < h; t++) {
|
|
21
|
-
const f = i[t].fn(e);
|
|
22
|
-
typeof f == "function" && (n || (n = []), n.push(f));
|
|
23
|
-
}
|
|
24
|
-
if (n)
|
|
25
|
-
for (let t = 0; t < n.length; t++)
|
|
26
|
-
n[t]();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
off(s, e) {
|
|
30
|
-
const i = this.listeners[s];
|
|
31
|
-
i && (this.listeners[s] = i.filter((r) => r.fn !== e));
|
|
32
|
-
}
|
|
33
|
-
on(s, e) {
|
|
34
|
-
this.add(s, e, !1);
|
|
35
|
-
}
|
|
36
|
-
once(s, e) {
|
|
37
|
-
this.add(s, e, !0);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Check whether there are any listeners registered for the given event.
|
|
41
|
-
*/
|
|
42
|
-
hasListeners(s) {
|
|
43
|
-
const e = this.listeners[s];
|
|
44
|
-
return e !== void 0 && e.length > 0;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Reset the event emitter
|
|
48
|
-
*/
|
|
49
|
-
reset() {
|
|
50
|
-
this.listeners = {};
|
|
51
|
-
}
|
|
52
|
-
add(s, e, i) {
|
|
53
|
-
const r = this.listeners[s], n = { fn: e, once: i };
|
|
54
|
-
r ? r.push(n) : this.listeners[s] = [n];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
u as E
|
|
59
|
-
};
|