@vindral/web-sdk 4.1.2 → 4.1.3
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/{hRzek83o.js → Bs3ZbgIy.js} +90 -69
- package/CvnFcokQ.js +125 -0
- package/{ZD9OGvpf.js → DykhWWFG.js} +797 -750
- package/api-client.js +1 -1
- package/core.d.ts +11 -2
- package/core.js +1 -1
- package/legacy.d.ts +13 -3
- package/legacy.es.js +7397 -7331
- package/legacy.umd.js +9 -9
- package/package.json +1 -1
- package/player.d.ts +11 -2
- package/player.js +24 -12
- package/react.d.ts +11 -2
- package/{CI-d-Lzb.js → ypJV-2eL.js} +9 -9
- package/C-MEaX21.js +0 -127
- package/style.css +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
var C = Object.defineProperty, R = Object.defineProperties;
|
|
2
2
|
var q = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
4
|
-
var A = Object.prototype.hasOwnProperty,
|
|
3
|
+
var b = Object.getOwnPropertySymbols;
|
|
4
|
+
var A = Object.prototype.hasOwnProperty, O = Object.prototype.propertyIsEnumerable;
|
|
5
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
6
|
for (var n in t || (t = {}))
|
|
7
7
|
A.call(t, n) && w(e, n, t[n]);
|
|
8
|
-
if (
|
|
9
|
-
for (var n of
|
|
10
|
-
|
|
8
|
+
if (b)
|
|
9
|
+
for (var n of b(t))
|
|
10
|
+
O.call(t, n) && w(e, n, t[n]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
12
|
+
}, g = (e, t) => R(e, q(t));
|
|
13
13
|
var d = (e, t, n) => w(e, typeof t != "symbol" ? t + "" : t, n);
|
|
14
|
-
var l = (e, t, n) => new Promise((
|
|
14
|
+
var l = (e, t, n) => new Promise((r, s) => {
|
|
15
15
|
var a = (o) => {
|
|
16
16
|
try {
|
|
17
17
|
i(n.next(o));
|
|
18
18
|
} catch (h) {
|
|
19
|
-
|
|
19
|
+
s(h);
|
|
20
20
|
}
|
|
21
21
|
}, c = (o) => {
|
|
22
22
|
try {
|
|
23
23
|
i(n.throw(o));
|
|
24
24
|
} catch (h) {
|
|
25
|
-
|
|
25
|
+
s(h);
|
|
26
26
|
}
|
|
27
|
-
}, i = (o) => o.done ?
|
|
27
|
+
}, i = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(a, c);
|
|
28
28
|
i((n = n.apply(e, t)).next());
|
|
29
29
|
});
|
|
30
|
-
const
|
|
30
|
+
const y = (e) => {
|
|
31
31
|
switch (e) {
|
|
32
32
|
case "h264":
|
|
33
33
|
case "av1":
|
|
@@ -42,60 +42,60 @@ const m = (e) => {
|
|
|
42
42
|
throw new Error("Unknown codec");
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
function
|
|
45
|
+
function f(e, t) {
|
|
46
46
|
if (!e)
|
|
47
47
|
throw new Error(t);
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const P = (e) => {
|
|
50
50
|
try {
|
|
51
51
|
return JSON.parse(e);
|
|
52
52
|
} catch (t) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function J(e) {
|
|
57
57
|
return !(typeof e.edges[0] == "string" || e.channels[0] && !("catalog" in e.channels[0]));
|
|
58
58
|
}
|
|
59
59
|
function j(e) {
|
|
60
|
-
return e.tracks.filter((t) => !!t.codec).filter((t) =>
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const a =
|
|
64
|
-
if (
|
|
60
|
+
return e.tracks.filter((t) => !!t.codec).filter((t) => U(t.codec || "")).map((t, n) => {
|
|
61
|
+
const r = t.codec, s = t.bitrate;
|
|
62
|
+
f(r, "codec is required"), f(s != null, "bitrate is required");
|
|
63
|
+
const a = U(r);
|
|
64
|
+
if (f(a, "codec is required"), y(a) === "audio") {
|
|
65
65
|
const c = t.samplerate || 0, i = t.channelConfig === "stereo" ? 2 : 1;
|
|
66
66
|
return {
|
|
67
67
|
track: t,
|
|
68
68
|
id: n,
|
|
69
69
|
codec: a,
|
|
70
|
-
codecString:
|
|
71
|
-
bitRate:
|
|
70
|
+
codecString: r,
|
|
71
|
+
bitRate: s,
|
|
72
72
|
channels: i,
|
|
73
73
|
sampleRate: c,
|
|
74
74
|
language: t.language
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return y(a) === "text" ? {
|
|
78
78
|
track: t,
|
|
79
79
|
id: n,
|
|
80
80
|
bitRate: 0,
|
|
81
81
|
codec: a,
|
|
82
82
|
kind: "subtitles",
|
|
83
|
-
codecString:
|
|
83
|
+
codecString: r,
|
|
84
84
|
label: t.label,
|
|
85
85
|
language: t.language
|
|
86
|
-
} : (
|
|
86
|
+
} : (f(t.width, "width is required"), f(t.height, "width is required"), f(t.framerate, "framerate is required"), {
|
|
87
87
|
track: t,
|
|
88
88
|
id: n,
|
|
89
89
|
codec: a,
|
|
90
|
-
bitRate:
|
|
91
|
-
codecString:
|
|
90
|
+
bitRate: s,
|
|
91
|
+
codecString: r,
|
|
92
92
|
width: t.width,
|
|
93
93
|
height: t.height,
|
|
94
94
|
frameRate: t.framerate
|
|
95
95
|
});
|
|
96
96
|
}).sort((t, n) => t.bitRate - n.bitRate);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function U(e) {
|
|
99
99
|
if (e.startsWith("opus"))
|
|
100
100
|
return "opus";
|
|
101
101
|
if (e.startsWith("mp4a"))
|
|
@@ -107,38 +107,59 @@ function I(e) {
|
|
|
107
107
|
if (e.startsWith("webvtt"))
|
|
108
108
|
return "webvtt";
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const L = (e) => e ? {
|
|
111
111
|
Authorization: `Bearer ${e}`
|
|
112
|
-
} : void 0,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
} : void 0, G = (e, t) => {
|
|
113
|
+
try {
|
|
114
|
+
const n = e.ancestorOrigins;
|
|
115
|
+
if (n && n.length > 0)
|
|
116
|
+
return Array.from(n).join(",") || void 0;
|
|
117
|
+
} catch (n) {
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
if (t.referrer)
|
|
121
|
+
return new URL(t.referrer).origin || void 0;
|
|
122
|
+
} catch (n) {
|
|
123
|
+
}
|
|
124
|
+
}, E = (e) => typeof e == "object" && e !== null && "message" in e;
|
|
125
|
+
class H extends Error {
|
|
126
|
+
constructor({ status: n, url: r, body: s }) {
|
|
127
|
+
const a = P(s), c = E(a) ? a.message : `Url ${r.toString()}, Status code: ${n}, Body: ${s}`;
|
|
116
128
|
super(c);
|
|
117
129
|
d(this, "status");
|
|
118
130
|
d(this, "body");
|
|
119
131
|
d(this, "url");
|
|
120
|
-
this.status = n, this.body =
|
|
132
|
+
this.status = n, this.body = s, this.url = r, Object.setPrototypeOf(this, new.target.prototype);
|
|
121
133
|
}
|
|
122
134
|
}
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
const M = (e) => typeof e.status == "number", S = () => {
|
|
136
|
+
if (!(typeof window == "undefined" || typeof document == "undefined"))
|
|
137
|
+
return G(window.location, document);
|
|
138
|
+
}, T = (e) => {
|
|
139
|
+
const t = S();
|
|
140
|
+
if (!t || e.searchParams.has("parentOrigin"))
|
|
141
|
+
return e;
|
|
142
|
+
const n = new URL(e.toString());
|
|
143
|
+
return n.searchParams.append("parentOrigin", t), n;
|
|
144
|
+
}, $ = (e, t) => l(null, null, function* () {
|
|
145
|
+
const n = T(e), r = yield fetch(n.toString(), u({ mode: "cors" }, t));
|
|
146
|
+
if (!r.ok)
|
|
147
|
+
throw new H({ status: r.status, url: n, body: yield r.text() });
|
|
148
|
+
return r;
|
|
149
|
+
}), m = (e, t) => l(null, null, function* () {
|
|
129
150
|
return yield (yield $(e, u({}, t))).json();
|
|
130
|
-
}),
|
|
151
|
+
}), z = (e, t) => l(null, null, function* () {
|
|
131
152
|
return $(e, u({ method: "POST" }, t));
|
|
132
153
|
});
|
|
133
154
|
function W(e) {
|
|
134
155
|
var t;
|
|
135
156
|
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");
|
|
136
157
|
}
|
|
137
|
-
const
|
|
158
|
+
const I = {
|
|
138
159
|
lbConnect: (e) => e.channelGroupId ? `connect?channelId=${e.channelId}&channelGroupId=${e.channelGroupId}` : `connect?channelId=${e.channelId}`,
|
|
139
160
|
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"
|
|
140
161
|
};
|
|
141
|
-
class
|
|
162
|
+
class N {
|
|
142
163
|
constructor(t) {
|
|
143
164
|
d(this, "baseUrl");
|
|
144
165
|
d(this, "tokenFactory");
|
|
@@ -150,19 +171,19 @@ class J {
|
|
|
150
171
|
*/
|
|
151
172
|
connect(t) {
|
|
152
173
|
return l(this, null, function* () {
|
|
153
|
-
const { channelId: n, channelGroupId:
|
|
174
|
+
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) });
|
|
154
175
|
if (W(i)) {
|
|
155
176
|
const o = i.channels.map((h) => {
|
|
156
|
-
const
|
|
157
|
-
return
|
|
177
|
+
const p = this.toChannel(h, s), v = j(h.catalog);
|
|
178
|
+
return g(u(u({}, h), p), { renditions: v });
|
|
158
179
|
});
|
|
159
|
-
return
|
|
180
|
+
return g(u({}, i), { channels: o });
|
|
160
181
|
} else {
|
|
161
182
|
const o = i.channels.map((h) => {
|
|
162
|
-
const
|
|
163
|
-
return u(u({}, h),
|
|
183
|
+
const p = this.toChannel(h, s);
|
|
184
|
+
return u(u({}, h), p);
|
|
164
185
|
});
|
|
165
|
-
return
|
|
186
|
+
return g(u({}, i), { channels: o });
|
|
166
187
|
}
|
|
167
188
|
});
|
|
168
189
|
}
|
|
@@ -174,8 +195,8 @@ class J {
|
|
|
174
195
|
*/
|
|
175
196
|
getChannel(t) {
|
|
176
197
|
return l(this, null, function* () {
|
|
177
|
-
const n = { channelId: t },
|
|
178
|
-
return this.toChannel(a, n,
|
|
198
|
+
const n = { channelId: t }, r = new URL(`channel/${t}`, this.baseUrl), s = this.getAuthToken(n), a = yield m(r, { headers: this.getHeaders(s) });
|
|
199
|
+
return this.toChannel(a, n, s);
|
|
179
200
|
});
|
|
180
201
|
}
|
|
181
202
|
/**
|
|
@@ -188,27 +209,27 @@ class J {
|
|
|
188
209
|
*/
|
|
189
210
|
getChannels(t) {
|
|
190
211
|
return l(this, null, function* () {
|
|
191
|
-
const n = { channelGroupId: t },
|
|
192
|
-
headers: this.getHeaders(
|
|
212
|
+
const n = { channelGroupId: t }, r = new URL(`channels/${t}`, this.baseUrl), s = this.getAuthToken(n), a = yield m(r, {
|
|
213
|
+
headers: this.getHeaders(s)
|
|
193
214
|
}), c = Array.isArray(a) ? a : a.channels;
|
|
194
|
-
return this.toChannels(c, n,
|
|
215
|
+
return this.toChannels(c, n, s);
|
|
195
216
|
});
|
|
196
217
|
}
|
|
197
218
|
getHeaders(t) {
|
|
198
|
-
var
|
|
199
|
-
return (
|
|
219
|
+
var r;
|
|
220
|
+
return (r = L(t)) != null ? r : {};
|
|
200
221
|
}
|
|
201
222
|
getAuthToken(t) {
|
|
202
223
|
return this.tokenFactory ? this.tokenFactory(t) : void 0;
|
|
203
224
|
}
|
|
204
|
-
toChannels(t, n,
|
|
205
|
-
return t.map((
|
|
225
|
+
toChannels(t, n, r) {
|
|
226
|
+
return t.map((s) => this.toChannel(s, n, r));
|
|
206
227
|
}
|
|
207
|
-
toChannel(t, n,
|
|
208
|
-
const { baseUrl:
|
|
228
|
+
toChannel(t, n, r) {
|
|
229
|
+
const { baseUrl: s, sizes: a } = t.thumbnail, c = s || new URL(I.thumbnails(n, r), this.baseUrl), i = a.map((o) => new URL(
|
|
209
230
|
`?channelId=${t.channelId}&width=${o.width}&height=${o.height}${F(
|
|
210
231
|
n,
|
|
211
|
-
|
|
232
|
+
r
|
|
212
233
|
)}`,
|
|
213
234
|
c
|
|
214
235
|
).toString());
|
|
@@ -222,13 +243,13 @@ class J {
|
|
|
222
243
|
}
|
|
223
244
|
const F = (e, t) => t ? e.channelGroupId ? `&channelGroupId=${e.channelGroupId}&auth.token=${t}&auth.type=jwt` : `&auth.token=${t}&auth.type=jwt` : "";
|
|
224
245
|
export {
|
|
225
|
-
|
|
226
|
-
|
|
246
|
+
N as A,
|
|
247
|
+
f as a,
|
|
227
248
|
j as b,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
249
|
+
U as c,
|
|
250
|
+
M as d,
|
|
251
|
+
y as e,
|
|
252
|
+
J as i,
|
|
253
|
+
z as p,
|
|
254
|
+
P as t
|
|
234
255
|
};
|