@alpha-video-kit/svg 0.3.1 → 0.4.0
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/dist/canvas-component-DRs32j73.js +527 -0
- package/dist/canvas-component-DduUMloe.cjs +46 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +16 -31
- package/dist/register.cjs +1 -1
- package/dist/register.js +1 -1
- package/package.json +1 -1
- package/dist/canvas-component-Cu612Agl.cjs +0 -23
- package/dist/canvas-component-zHBwAZuP.js +0 -471
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var V = (o) => {
|
|
3
|
+
throw TypeError(o);
|
|
4
|
+
};
|
|
5
|
+
var K = (o, a, t) => a in o ? j(o, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[a] = t;
|
|
6
|
+
var D = (o, a, t) => K(o, typeof a != "symbol" ? a + "" : a, t), F = (o, a, t) => a.has(o) || V("Cannot " + t);
|
|
7
|
+
var e = (o, a, t) => (F(o, a, "read from private field"), t ? t.call(o) : a.get(o)), d = (o, a, t) => a.has(o) ? V("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(o) : a.set(o, t), h = (o, a, t, s) => (F(o, a, "write to private field"), s ? s.call(o, t) : a.set(o, t), t), c = (o, a, t) => (F(o, a, "access private method"), t);
|
|
8
|
+
const J = `
|
|
9
|
+
precision mediump float;
|
|
10
|
+
attribute vec2 a_position;
|
|
11
|
+
varying vec2 v_texCoord;
|
|
12
|
+
|
|
13
|
+
void main() {
|
|
14
|
+
gl_Position = vec4(a_position * 2.0 - 1.0, 0, 1);
|
|
15
|
+
v_texCoord = vec2(a_position.x, 1.0 - a_position.y);
|
|
16
|
+
}
|
|
17
|
+
`, Q = `
|
|
18
|
+
precision mediump float;
|
|
19
|
+
uniform sampler2D u_frame;
|
|
20
|
+
varying vec2 v_texCoord;
|
|
21
|
+
|
|
22
|
+
void main() {
|
|
23
|
+
vec2 colorCoord = vec2(v_texCoord.x, v_texCoord.y * 0.5);
|
|
24
|
+
vec2 alphaCoord = vec2(v_texCoord.x, 0.5 + v_texCoord.y * 0.5);
|
|
25
|
+
|
|
26
|
+
vec4 color = texture2D(u_frame, colorCoord);
|
|
27
|
+
float alpha = texture2D(u_frame, alphaCoord).r;
|
|
28
|
+
|
|
29
|
+
gl_FragColor = vec4(color.rgb * alpha, alpha);
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
let S = null;
|
|
33
|
+
function W(o, a, t) {
|
|
34
|
+
const s = o.createShader(t);
|
|
35
|
+
if (!s) throw new Error("Failed to create shader");
|
|
36
|
+
if (o.shaderSource(s, a), o.compileShader(s), !o.getShaderParameter(s, o.COMPILE_STATUS)) {
|
|
37
|
+
const n = o.getShaderInfoLog(s);
|
|
38
|
+
throw o.deleteShader(s), new Error(`Shader compile error: ${n}`);
|
|
39
|
+
}
|
|
40
|
+
return s;
|
|
41
|
+
}
|
|
42
|
+
function Z() {
|
|
43
|
+
if (S)
|
|
44
|
+
return S.refCount++, S;
|
|
45
|
+
const o = document.createElement("canvas"), a = {
|
|
46
|
+
antialias: !1,
|
|
47
|
+
depth: !1,
|
|
48
|
+
premultipliedAlpha: !0,
|
|
49
|
+
powerPreference: "low-power"
|
|
50
|
+
}, t = o.getContext("webgl2", a) ?? o.getContext("webgl", a);
|
|
51
|
+
if (!t) throw new Error("WebGL not supported");
|
|
52
|
+
const s = W(t, J, t.VERTEX_SHADER), n = W(t, Q, t.FRAGMENT_SHADER), g = t.createProgram();
|
|
53
|
+
if (t.attachShader(g, s), t.attachShader(g, n), t.linkProgram(g), !t.getProgramParameter(g, t.LINK_STATUS))
|
|
54
|
+
throw new Error(`Program link error: ${t.getProgramInfoLog(g)}`);
|
|
55
|
+
t.useProgram(g);
|
|
56
|
+
const p = t.getAttribLocation(g, "a_position"), f = t.createBuffer();
|
|
57
|
+
t.bindBuffer(t.ARRAY_BUFFER, f), t.bufferData(
|
|
58
|
+
t.ARRAY_BUFFER,
|
|
59
|
+
new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]),
|
|
60
|
+
t.STATIC_DRAW
|
|
61
|
+
), t.enableVertexAttribArray(p), t.vertexAttribPointer(p, 2, t.FLOAT, !1, 0, 0);
|
|
62
|
+
const l = t.createTexture();
|
|
63
|
+
return t.bindTexture(t.TEXTURE_2D, l), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR), t.enable(t.BLEND), t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA), S = { canvas: o, gl: t, texture: l, program: g, vertexShader: s, fragmentShader: n, buffer: f, refCount: 1 }, S;
|
|
64
|
+
}
|
|
65
|
+
function tt(o, a, t, s) {
|
|
66
|
+
const n = a.videoWidth, g = a.videoHeight, p = Math.floor(g / 2);
|
|
67
|
+
(t.width !== n || t.height !== p) && (t.width = n, t.height = p);
|
|
68
|
+
const { canvas: f, gl: l, texture: z } = o;
|
|
69
|
+
(f.width !== n || f.height !== p) && (f.width = n, f.height = p, l.viewport(0, 0, n, p)), l.useProgram(o.program), l.bindBuffer(l.ARRAY_BUFFER, o.buffer);
|
|
70
|
+
const G = l.getAttribLocation(o.program, "a_position");
|
|
71
|
+
l.enableVertexAttribArray(G), l.vertexAttribPointer(G, 2, l.FLOAT, !1, 0, 0), l.bindTexture(l.TEXTURE_2D, z), l.texImage2D(l.TEXTURE_2D, 0, l.RGBA, l.RGBA, l.UNSIGNED_BYTE, a), l.drawArrays(l.TRIANGLES, 0, 6), s.clearRect(0, 0, n, p), s.drawImage(f, 0, 0);
|
|
72
|
+
}
|
|
73
|
+
function et() {
|
|
74
|
+
return Z();
|
|
75
|
+
}
|
|
76
|
+
function rt(o) {
|
|
77
|
+
if (o === S && (o.refCount--, o.refCount <= 0)) {
|
|
78
|
+
const { gl: a, texture: t, buffer: s, program: n, vertexShader: g, fragmentShader: p } = o;
|
|
79
|
+
a.deleteTexture(t), a.deleteBuffer(s), a.deleteProgram(n), a.deleteShader(g), a.deleteShader(p);
|
|
80
|
+
const f = a.getExtension("WEBGL_lose_context");
|
|
81
|
+
f && f.loseContext(), S = null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const X = [
|
|
85
|
+
"src",
|
|
86
|
+
"crossorigin",
|
|
87
|
+
"preload",
|
|
88
|
+
"autoplay",
|
|
89
|
+
"loop",
|
|
90
|
+
"muted",
|
|
91
|
+
"playsinline",
|
|
92
|
+
"poster",
|
|
93
|
+
"width",
|
|
94
|
+
"height"
|
|
95
|
+
], it = /* @__PURE__ */ new Set(["autoplay", "loop", "muted", "playsinline"]), st = [
|
|
96
|
+
"loadstart",
|
|
97
|
+
"progress",
|
|
98
|
+
"suspend",
|
|
99
|
+
"abort",
|
|
100
|
+
"error",
|
|
101
|
+
"emptied",
|
|
102
|
+
"stalled",
|
|
103
|
+
"loadedmetadata",
|
|
104
|
+
"loadeddata",
|
|
105
|
+
"canplay",
|
|
106
|
+
"canplaythrough",
|
|
107
|
+
"playing",
|
|
108
|
+
"waiting",
|
|
109
|
+
"seeking",
|
|
110
|
+
"seeked",
|
|
111
|
+
"ended",
|
|
112
|
+
"durationchange",
|
|
113
|
+
"timeupdate",
|
|
114
|
+
"play",
|
|
115
|
+
"pause",
|
|
116
|
+
"ratechange",
|
|
117
|
+
"resize",
|
|
118
|
+
"volumechange"
|
|
119
|
+
];
|
|
120
|
+
var i, x, w, k, L, T, C, b, M, I, H;
|
|
121
|
+
class ot extends HTMLElement {
|
|
122
|
+
constructor() {
|
|
123
|
+
super();
|
|
124
|
+
d(this, b);
|
|
125
|
+
d(this, i);
|
|
126
|
+
d(this, x);
|
|
127
|
+
d(this, w);
|
|
128
|
+
d(this, k);
|
|
129
|
+
d(this, L);
|
|
130
|
+
d(this, T, null);
|
|
131
|
+
d(this, C);
|
|
132
|
+
const t = this.attachShadow({ mode: "open" });
|
|
133
|
+
h(this, C, `avk-${Math.random().toString(36).slice(2, 8)}`), t.innerHTML = `<style>
|
|
134
|
+
:host{display:inline-block;overflow:hidden}
|
|
135
|
+
svg{display:block;width:100%;height:auto}
|
|
136
|
+
video{display:block;width:100%;height:100%}
|
|
137
|
+
</style>
|
|
138
|
+
<svg viewBox="0 0 1 1" preserveAspectRatio="xMidYMid meet">
|
|
139
|
+
<defs>
|
|
140
|
+
<filter id="${e(this, C)}" filterUnits="userSpaceOnUse" x="0" y="0" width="1" height="1" color-interpolation-filters="sRGB">
|
|
141
|
+
<feOffset in="SourceGraphic" dy="0" result="s"/>
|
|
142
|
+
<feColorMatrix in="s" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0" result="a"/>
|
|
143
|
+
<feComposite in="SourceGraphic" in2="a" operator="in"/>
|
|
144
|
+
</filter>
|
|
145
|
+
</defs>
|
|
146
|
+
<foreignObject width="1" height="1" filter="url(#${e(this, C)})">
|
|
147
|
+
<video></video>
|
|
148
|
+
</foreignObject>
|
|
149
|
+
</svg>`, h(this, x, t.querySelector("svg")), h(this, w, t.querySelector("foreignObject")), h(this, k, t.querySelector("filter")), h(this, L, t.querySelector("feOffset")), h(this, i, t.querySelector("video"));
|
|
150
|
+
for (const s of st)
|
|
151
|
+
e(this, i).addEventListener(s, (n) => {
|
|
152
|
+
this.dispatchEvent(new Event(n.type, { bubbles: !1, cancelable: !1 }));
|
|
153
|
+
});
|
|
154
|
+
e(this, i).addEventListener("loadedmetadata", () => c(this, b, M).call(this)), e(this, i).addEventListener("resize", () => c(this, b, M).call(this));
|
|
155
|
+
}
|
|
156
|
+
connectedCallback() {
|
|
157
|
+
for (const t of X)
|
|
158
|
+
this.hasAttribute(t) && c(this, b, I).call(this, t, this.getAttribute(t));
|
|
159
|
+
c(this, b, H).call(this), h(this, T, new MutationObserver(() => c(this, b, H).call(this))), e(this, T).observe(this, { childList: !0 });
|
|
160
|
+
}
|
|
161
|
+
disconnectedCallback() {
|
|
162
|
+
var t;
|
|
163
|
+
(t = e(this, T)) == null || t.disconnect(), h(this, T, null);
|
|
164
|
+
}
|
|
165
|
+
attributeChangedCallback(t, s, n) {
|
|
166
|
+
c(this, b, I).call(this, t, n);
|
|
167
|
+
}
|
|
168
|
+
// --- Proxied properties ---
|
|
169
|
+
get src() {
|
|
170
|
+
return e(this, i).src;
|
|
171
|
+
}
|
|
172
|
+
set src(t) {
|
|
173
|
+
this.setAttribute("src", t);
|
|
174
|
+
}
|
|
175
|
+
get currentSrc() {
|
|
176
|
+
return e(this, i).currentSrc;
|
|
177
|
+
}
|
|
178
|
+
get currentTime() {
|
|
179
|
+
return e(this, i).currentTime;
|
|
180
|
+
}
|
|
181
|
+
set currentTime(t) {
|
|
182
|
+
e(this, i).currentTime = t;
|
|
183
|
+
}
|
|
184
|
+
get duration() {
|
|
185
|
+
return e(this, i).duration;
|
|
186
|
+
}
|
|
187
|
+
get paused() {
|
|
188
|
+
return e(this, i).paused;
|
|
189
|
+
}
|
|
190
|
+
get ended() {
|
|
191
|
+
return e(this, i).ended;
|
|
192
|
+
}
|
|
193
|
+
get readyState() {
|
|
194
|
+
return e(this, i).readyState;
|
|
195
|
+
}
|
|
196
|
+
get videoWidth() {
|
|
197
|
+
return e(this, i).videoWidth;
|
|
198
|
+
}
|
|
199
|
+
get videoHeight() {
|
|
200
|
+
return Math.floor(e(this, i).videoHeight / 2);
|
|
201
|
+
}
|
|
202
|
+
get volume() {
|
|
203
|
+
return e(this, i).volume;
|
|
204
|
+
}
|
|
205
|
+
set volume(t) {
|
|
206
|
+
e(this, i).volume = t;
|
|
207
|
+
}
|
|
208
|
+
get playbackRate() {
|
|
209
|
+
return e(this, i).playbackRate;
|
|
210
|
+
}
|
|
211
|
+
set playbackRate(t) {
|
|
212
|
+
e(this, i).playbackRate = t;
|
|
213
|
+
}
|
|
214
|
+
get defaultPlaybackRate() {
|
|
215
|
+
return e(this, i).defaultPlaybackRate;
|
|
216
|
+
}
|
|
217
|
+
set defaultPlaybackRate(t) {
|
|
218
|
+
e(this, i).defaultPlaybackRate = t;
|
|
219
|
+
}
|
|
220
|
+
get muted() {
|
|
221
|
+
return e(this, i).muted;
|
|
222
|
+
}
|
|
223
|
+
set muted(t) {
|
|
224
|
+
e(this, i).muted = t, this.toggleAttribute("muted", t);
|
|
225
|
+
}
|
|
226
|
+
get loop() {
|
|
227
|
+
return e(this, i).loop;
|
|
228
|
+
}
|
|
229
|
+
set loop(t) {
|
|
230
|
+
e(this, i).loop = t, this.toggleAttribute("loop", t);
|
|
231
|
+
}
|
|
232
|
+
get autoplay() {
|
|
233
|
+
return e(this, i).autoplay;
|
|
234
|
+
}
|
|
235
|
+
set autoplay(t) {
|
|
236
|
+
e(this, i).autoplay = t, this.toggleAttribute("autoplay", t);
|
|
237
|
+
}
|
|
238
|
+
get preload() {
|
|
239
|
+
return e(this, i).preload;
|
|
240
|
+
}
|
|
241
|
+
set preload(t) {
|
|
242
|
+
this.setAttribute("preload", t);
|
|
243
|
+
}
|
|
244
|
+
get crossOrigin() {
|
|
245
|
+
return e(this, i).crossOrigin;
|
|
246
|
+
}
|
|
247
|
+
set crossOrigin(t) {
|
|
248
|
+
t === null ? this.removeAttribute("crossorigin") : this.setAttribute("crossorigin", t);
|
|
249
|
+
}
|
|
250
|
+
get buffered() {
|
|
251
|
+
return e(this, i).buffered;
|
|
252
|
+
}
|
|
253
|
+
get seekable() {
|
|
254
|
+
return e(this, i).seekable;
|
|
255
|
+
}
|
|
256
|
+
get played() {
|
|
257
|
+
return e(this, i).played;
|
|
258
|
+
}
|
|
259
|
+
get networkState() {
|
|
260
|
+
return e(this, i).networkState;
|
|
261
|
+
}
|
|
262
|
+
get error() {
|
|
263
|
+
return e(this, i).error;
|
|
264
|
+
}
|
|
265
|
+
get seeking() {
|
|
266
|
+
return e(this, i).seeking;
|
|
267
|
+
}
|
|
268
|
+
// --- Proxied methods ---
|
|
269
|
+
play() {
|
|
270
|
+
return e(this, i).play();
|
|
271
|
+
}
|
|
272
|
+
pause() {
|
|
273
|
+
e(this, i).pause();
|
|
274
|
+
}
|
|
275
|
+
load() {
|
|
276
|
+
e(this, i).load();
|
|
277
|
+
}
|
|
278
|
+
canPlayType(t) {
|
|
279
|
+
return e(this, i).canPlayType(t);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
i = new WeakMap(), x = new WeakMap(), w = new WeakMap(), k = new WeakMap(), L = new WeakMap(), T = new WeakMap(), C = new WeakMap(), b = new WeakSet(), M = function() {
|
|
283
|
+
const t = e(this, i).videoWidth, s = e(this, i).videoHeight;
|
|
284
|
+
if (!t || !s) return;
|
|
285
|
+
const n = Math.floor(s / 2);
|
|
286
|
+
e(this, x).setAttribute("viewBox", `0 0 ${t} ${n}`), e(this, w).setAttribute("width", String(t)), e(this, w).setAttribute("height", String(s)), e(this, k).setAttribute("width", String(t)), e(this, k).setAttribute("height", String(s)), e(this, L).setAttribute("dy", String(-n));
|
|
287
|
+
}, I = function(t, s) {
|
|
288
|
+
it.has(t) ? e(this, i)[t] = s !== null : s === null ? e(this, i).removeAttribute(t) : e(this, i).setAttribute(t, s);
|
|
289
|
+
}, H = function() {
|
|
290
|
+
e(this, i).querySelectorAll("source").forEach((t) => t.remove()), this.querySelectorAll("source").forEach((t) => {
|
|
291
|
+
e(this, i).appendChild(t.cloneNode(!0));
|
|
292
|
+
}), e(this, i).querySelectorAll("source").length > 0 && !e(this, i).src && e(this, i).load();
|
|
293
|
+
}, D(ot, "observedAttributes", [...X]);
|
|
294
|
+
const $ = [
|
|
295
|
+
"src",
|
|
296
|
+
"crossorigin",
|
|
297
|
+
"preload",
|
|
298
|
+
"autoplay",
|
|
299
|
+
"loop",
|
|
300
|
+
"muted",
|
|
301
|
+
"playsinline",
|
|
302
|
+
"poster",
|
|
303
|
+
"width",
|
|
304
|
+
"height"
|
|
305
|
+
], at = /* @__PURE__ */ new Set(["autoplay", "loop", "muted", "playsinline"]), nt = [
|
|
306
|
+
"loadstart",
|
|
307
|
+
"progress",
|
|
308
|
+
"suspend",
|
|
309
|
+
"abort",
|
|
310
|
+
"error",
|
|
311
|
+
"emptied",
|
|
312
|
+
"stalled",
|
|
313
|
+
"loadedmetadata",
|
|
314
|
+
"loadeddata",
|
|
315
|
+
"canplay",
|
|
316
|
+
"canplaythrough",
|
|
317
|
+
"playing",
|
|
318
|
+
"waiting",
|
|
319
|
+
"seeking",
|
|
320
|
+
"seeked",
|
|
321
|
+
"ended",
|
|
322
|
+
"durationchange",
|
|
323
|
+
"timeupdate",
|
|
324
|
+
"play",
|
|
325
|
+
"pause",
|
|
326
|
+
"ratechange",
|
|
327
|
+
"resize",
|
|
328
|
+
"volumechange"
|
|
329
|
+
];
|
|
330
|
+
var r, y, P, R, _, v, A, E, m, u, U, q, N, Y, O, B;
|
|
331
|
+
class ht extends HTMLElement {
|
|
332
|
+
constructor() {
|
|
333
|
+
super();
|
|
334
|
+
d(this, u);
|
|
335
|
+
d(this, r);
|
|
336
|
+
d(this, y);
|
|
337
|
+
d(this, P);
|
|
338
|
+
d(this, R, null);
|
|
339
|
+
d(this, _, null);
|
|
340
|
+
d(this, v, !1);
|
|
341
|
+
d(this, A, 0);
|
|
342
|
+
d(this, E, 0);
|
|
343
|
+
d(this, m, null);
|
|
344
|
+
const t = this.attachShadow({ mode: "open" });
|
|
345
|
+
t.innerHTML = `<style>
|
|
346
|
+
:host{display:inline-block;overflow:hidden}
|
|
347
|
+
video{position:absolute;opacity:0;pointer-events:none;width:0;height:0}
|
|
348
|
+
canvas{display:block;width:100%}
|
|
349
|
+
</style>
|
|
350
|
+
<video></video>
|
|
351
|
+
<canvas></canvas>`, h(this, r, t.querySelector("video")), h(this, y, t.querySelector("canvas")), h(this, P, e(this, y).getContext("2d"));
|
|
352
|
+
for (const s of nt)
|
|
353
|
+
e(this, r).addEventListener(s, (n) => {
|
|
354
|
+
this.dispatchEvent(new Event(n.type, { bubbles: !1, cancelable: !1 }));
|
|
355
|
+
});
|
|
356
|
+
e(this, r).addEventListener("loadedmetadata", () => c(this, u, U).call(this)), e(this, r).addEventListener("resize", () => c(this, u, U).call(this));
|
|
357
|
+
}
|
|
358
|
+
connectedCallback() {
|
|
359
|
+
for (const t of $)
|
|
360
|
+
this.hasAttribute(t) && c(this, u, q).call(this, t, this.getAttribute(t));
|
|
361
|
+
c(this, u, N).call(this), h(this, _, new MutationObserver(() => c(this, u, N).call(this))), e(this, _).observe(this, { childList: !0 }), h(this, m, et()), h(this, R, new IntersectionObserver(
|
|
362
|
+
([t]) => {
|
|
363
|
+
h(this, v, t.isIntersecting), e(this, v) ? c(this, u, Y).call(this) : c(this, u, O).call(this);
|
|
364
|
+
},
|
|
365
|
+
{ threshold: 0 }
|
|
366
|
+
)), e(this, R).observe(this);
|
|
367
|
+
}
|
|
368
|
+
disconnectedCallback() {
|
|
369
|
+
var t, s;
|
|
370
|
+
c(this, u, O).call(this), (t = e(this, R)) == null || t.disconnect(), h(this, R, null), (s = e(this, _)) == null || s.disconnect(), h(this, _, null), e(this, m) && (rt(e(this, m)), h(this, m, null));
|
|
371
|
+
}
|
|
372
|
+
attributeChangedCallback(t, s, n) {
|
|
373
|
+
c(this, u, q).call(this, t, n);
|
|
374
|
+
}
|
|
375
|
+
// --- Proxied properties ---
|
|
376
|
+
get src() {
|
|
377
|
+
return e(this, r).src;
|
|
378
|
+
}
|
|
379
|
+
set src(t) {
|
|
380
|
+
this.setAttribute("src", t);
|
|
381
|
+
}
|
|
382
|
+
get currentSrc() {
|
|
383
|
+
return e(this, r).currentSrc;
|
|
384
|
+
}
|
|
385
|
+
get currentTime() {
|
|
386
|
+
return e(this, r).currentTime;
|
|
387
|
+
}
|
|
388
|
+
set currentTime(t) {
|
|
389
|
+
e(this, r).currentTime = t;
|
|
390
|
+
}
|
|
391
|
+
get duration() {
|
|
392
|
+
return e(this, r).duration;
|
|
393
|
+
}
|
|
394
|
+
get paused() {
|
|
395
|
+
return e(this, r).paused;
|
|
396
|
+
}
|
|
397
|
+
get ended() {
|
|
398
|
+
return e(this, r).ended;
|
|
399
|
+
}
|
|
400
|
+
get readyState() {
|
|
401
|
+
return e(this, r).readyState;
|
|
402
|
+
}
|
|
403
|
+
get videoWidth() {
|
|
404
|
+
return e(this, r).videoWidth;
|
|
405
|
+
}
|
|
406
|
+
get videoHeight() {
|
|
407
|
+
return Math.floor(e(this, r).videoHeight / 2);
|
|
408
|
+
}
|
|
409
|
+
get volume() {
|
|
410
|
+
return e(this, r).volume;
|
|
411
|
+
}
|
|
412
|
+
set volume(t) {
|
|
413
|
+
e(this, r).volume = t;
|
|
414
|
+
}
|
|
415
|
+
get playbackRate() {
|
|
416
|
+
return e(this, r).playbackRate;
|
|
417
|
+
}
|
|
418
|
+
set playbackRate(t) {
|
|
419
|
+
e(this, r).playbackRate = t;
|
|
420
|
+
}
|
|
421
|
+
get defaultPlaybackRate() {
|
|
422
|
+
return e(this, r).defaultPlaybackRate;
|
|
423
|
+
}
|
|
424
|
+
set defaultPlaybackRate(t) {
|
|
425
|
+
e(this, r).defaultPlaybackRate = t;
|
|
426
|
+
}
|
|
427
|
+
get muted() {
|
|
428
|
+
return e(this, r).muted;
|
|
429
|
+
}
|
|
430
|
+
set muted(t) {
|
|
431
|
+
e(this, r).muted = t, this.toggleAttribute("muted", t);
|
|
432
|
+
}
|
|
433
|
+
get loop() {
|
|
434
|
+
return e(this, r).loop;
|
|
435
|
+
}
|
|
436
|
+
set loop(t) {
|
|
437
|
+
e(this, r).loop = t, this.toggleAttribute("loop", t);
|
|
438
|
+
}
|
|
439
|
+
get autoplay() {
|
|
440
|
+
return e(this, r).autoplay;
|
|
441
|
+
}
|
|
442
|
+
set autoplay(t) {
|
|
443
|
+
e(this, r).autoplay = t, this.toggleAttribute("autoplay", t);
|
|
444
|
+
}
|
|
445
|
+
get preload() {
|
|
446
|
+
return e(this, r).preload;
|
|
447
|
+
}
|
|
448
|
+
set preload(t) {
|
|
449
|
+
this.setAttribute("preload", t);
|
|
450
|
+
}
|
|
451
|
+
get crossOrigin() {
|
|
452
|
+
return e(this, r).crossOrigin;
|
|
453
|
+
}
|
|
454
|
+
set crossOrigin(t) {
|
|
455
|
+
t === null ? this.removeAttribute("crossorigin") : this.setAttribute("crossorigin", t);
|
|
456
|
+
}
|
|
457
|
+
get buffered() {
|
|
458
|
+
return e(this, r).buffered;
|
|
459
|
+
}
|
|
460
|
+
get seekable() {
|
|
461
|
+
return e(this, r).seekable;
|
|
462
|
+
}
|
|
463
|
+
get played() {
|
|
464
|
+
return e(this, r).played;
|
|
465
|
+
}
|
|
466
|
+
get networkState() {
|
|
467
|
+
return e(this, r).networkState;
|
|
468
|
+
}
|
|
469
|
+
get error() {
|
|
470
|
+
return e(this, r).error;
|
|
471
|
+
}
|
|
472
|
+
get seeking() {
|
|
473
|
+
return e(this, r).seeking;
|
|
474
|
+
}
|
|
475
|
+
// --- Proxied methods ---
|
|
476
|
+
play() {
|
|
477
|
+
return e(this, r).play();
|
|
478
|
+
}
|
|
479
|
+
pause() {
|
|
480
|
+
e(this, r).pause();
|
|
481
|
+
}
|
|
482
|
+
load() {
|
|
483
|
+
e(this, r).load();
|
|
484
|
+
}
|
|
485
|
+
canPlayType(t) {
|
|
486
|
+
return e(this, r).canPlayType(t);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
r = new WeakMap(), y = new WeakMap(), P = new WeakMap(), R = new WeakMap(), _ = new WeakMap(), v = new WeakMap(), A = new WeakMap(), E = new WeakMap(), m = new WeakMap(), u = new WeakSet(), U = function() {
|
|
490
|
+
const t = e(this, r).videoWidth, s = e(this, r).videoHeight;
|
|
491
|
+
if (!t || !s) return;
|
|
492
|
+
const n = Math.floor(s / 2);
|
|
493
|
+
e(this, y).width = t, e(this, y).height = n;
|
|
494
|
+
}, q = function(t, s) {
|
|
495
|
+
at.has(t) ? e(this, r)[t] = s !== null : s === null ? e(this, r).removeAttribute(t) : e(this, r).setAttribute(t, s);
|
|
496
|
+
}, N = function() {
|
|
497
|
+
e(this, r).querySelectorAll("source").forEach((t) => t.remove()), this.querySelectorAll("source").forEach((t) => {
|
|
498
|
+
e(this, r).appendChild(t.cloneNode(!0));
|
|
499
|
+
}), e(this, r).querySelectorAll("source").length > 0 && !e(this, r).src && e(this, r).load();
|
|
500
|
+
}, Y = function() {
|
|
501
|
+
if (e(this, v))
|
|
502
|
+
if (c(this, u, O).call(this), "requestVideoFrameCallback" in e(this, r)) {
|
|
503
|
+
const t = () => {
|
|
504
|
+
e(this, v) && (c(this, u, B).call(this), h(this, E, e(this, r).requestVideoFrameCallback(t)));
|
|
505
|
+
};
|
|
506
|
+
h(this, E, e(this, r).requestVideoFrameCallback(t));
|
|
507
|
+
} else {
|
|
508
|
+
const t = () => {
|
|
509
|
+
e(this, v) && (c(this, u, B).call(this), h(this, A, requestAnimationFrame(t)));
|
|
510
|
+
};
|
|
511
|
+
h(this, A, requestAnimationFrame(t));
|
|
512
|
+
}
|
|
513
|
+
}, O = function() {
|
|
514
|
+
var t, s;
|
|
515
|
+
e(this, E) && ((s = (t = e(this, r)).cancelVideoFrameCallback) == null || s.call(t, e(this, E)), h(this, E, 0)), e(this, A) && (cancelAnimationFrame(e(this, A)), h(this, A, 0));
|
|
516
|
+
}, B = function() {
|
|
517
|
+
if (e(this, r).readyState < 2 || !e(this, m)) return;
|
|
518
|
+
const t = e(this, r).videoWidth, s = e(this, r).videoHeight;
|
|
519
|
+
!t || !s || tt(e(this, m), e(this, r), e(this, y), e(this, P));
|
|
520
|
+
}, D(ht, "observedAttributes", [...$]);
|
|
521
|
+
export {
|
|
522
|
+
ht as A,
|
|
523
|
+
et as a,
|
|
524
|
+
ot as b,
|
|
525
|
+
tt as p,
|
|
526
|
+
rt as r
|
|
527
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";var tt=Object.defineProperty;var G=o=>{throw TypeError(o)};var et=(o,a,t)=>a in o?tt(o,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[a]=t;var F=(o,a,t)=>et(o,typeof a!="symbol"?a+"":a,t),D=(o,a,t)=>a.has(o)||G("Cannot "+t);var e=(o,a,t)=>(D(o,a,"read from private field"),t?t.call(o):a.get(o)),d=(o,a,t)=>a.has(o)?G("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(o):a.set(o,t),h=(o,a,t,s)=>(D(o,a,"write to private field"),s?s.call(o,t):a.set(o,t),t),c=(o,a,t)=>(D(o,a,"access private method"),t);const rt=`
|
|
2
|
+
precision mediump float;
|
|
3
|
+
attribute vec2 a_position;
|
|
4
|
+
varying vec2 v_texCoord;
|
|
5
|
+
|
|
6
|
+
void main() {
|
|
7
|
+
gl_Position = vec4(a_position * 2.0 - 1.0, 0, 1);
|
|
8
|
+
v_texCoord = vec2(a_position.x, 1.0 - a_position.y);
|
|
9
|
+
}
|
|
10
|
+
`,it=`
|
|
11
|
+
precision mediump float;
|
|
12
|
+
uniform sampler2D u_frame;
|
|
13
|
+
varying vec2 v_texCoord;
|
|
14
|
+
|
|
15
|
+
void main() {
|
|
16
|
+
vec2 colorCoord = vec2(v_texCoord.x, v_texCoord.y * 0.5);
|
|
17
|
+
vec2 alphaCoord = vec2(v_texCoord.x, 0.5 + v_texCoord.y * 0.5);
|
|
18
|
+
|
|
19
|
+
vec4 color = texture2D(u_frame, colorCoord);
|
|
20
|
+
float alpha = texture2D(u_frame, alphaCoord).r;
|
|
21
|
+
|
|
22
|
+
gl_FragColor = vec4(color.rgb * alpha, alpha);
|
|
23
|
+
}
|
|
24
|
+
`;let S=null;function W(o,a,t){const s=o.createShader(t);if(!s)throw new Error("Failed to create shader");if(o.shaderSource(s,a),o.compileShader(s),!o.getShaderParameter(s,o.COMPILE_STATUS)){const n=o.getShaderInfoLog(s);throw o.deleteShader(s),new Error(`Shader compile error: ${n}`)}return s}function st(){if(S)return S.refCount++,S;const o=document.createElement("canvas"),a={antialias:!1,depth:!1,premultipliedAlpha:!0,powerPreference:"low-power"},t=o.getContext("webgl2",a)??o.getContext("webgl",a);if(!t)throw new Error("WebGL not supported");const s=W(t,rt,t.VERTEX_SHADER),n=W(t,it,t.FRAGMENT_SHADER),g=t.createProgram();if(t.attachShader(g,s),t.attachShader(g,n),t.linkProgram(g),!t.getProgramParameter(g,t.LINK_STATUS))throw new Error(`Program link error: ${t.getProgramInfoLog(g)}`);t.useProgram(g);const p=t.getAttribLocation(g,"a_position"),f=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(p),t.vertexAttribPointer(p,2,t.FLOAT,!1,0,0);const l=t.createTexture();return t.bindTexture(t.TEXTURE_2D,l),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),S={canvas:o,gl:t,texture:l,program:g,vertexShader:s,fragmentShader:n,buffer:f,refCount:1},S}function Y(o,a,t,s){const n=a.videoWidth,g=a.videoHeight,p=Math.floor(g/2);(t.width!==n||t.height!==p)&&(t.width=n,t.height=p);const{canvas:f,gl:l,texture:Z}=o;(f.width!==n||f.height!==p)&&(f.width=n,f.height=p,l.viewport(0,0,n,p)),l.useProgram(o.program),l.bindBuffer(l.ARRAY_BUFFER,o.buffer);const V=l.getAttribLocation(o.program,"a_position");l.enableVertexAttribArray(V),l.vertexAttribPointer(V,2,l.FLOAT,!1,0,0),l.bindTexture(l.TEXTURE_2D,Z),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,a),l.drawArrays(l.TRIANGLES,0,6),s.clearRect(0,0,n,p),s.drawImage(f,0,0)}function z(){return st()}function j(o){if(o===S&&(o.refCount--,o.refCount<=0)){const{gl:a,texture:t,buffer:s,program:n,vertexShader:g,fragmentShader:p}=o;a.deleteTexture(t),a.deleteBuffer(s),a.deleteProgram(n),a.deleteShader(g),a.deleteShader(p);const f=a.getExtension("WEBGL_lose_context");f&&f.loseContext(),S=null}}const X=["src","crossorigin","preload","autoplay","loop","muted","playsinline","poster","width","height"],ot=new Set(["autoplay","loop","muted","playsinline"]),at=["loadstart","progress","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","play","pause","ratechange","resize","volumechange"];var i,x,w,k,L,T,C,b,M,I,H;class K extends HTMLElement{constructor(){super();d(this,b);d(this,i);d(this,x);d(this,w);d(this,k);d(this,L);d(this,T,null);d(this,C);const t=this.attachShadow({mode:"open"});h(this,C,`avk-${Math.random().toString(36).slice(2,8)}`),t.innerHTML=`<style>
|
|
25
|
+
:host{display:inline-block;overflow:hidden}
|
|
26
|
+
svg{display:block;width:100%;height:auto}
|
|
27
|
+
video{display:block;width:100%;height:100%}
|
|
28
|
+
</style>
|
|
29
|
+
<svg viewBox="0 0 1 1" preserveAspectRatio="xMidYMid meet">
|
|
30
|
+
<defs>
|
|
31
|
+
<filter id="${e(this,C)}" filterUnits="userSpaceOnUse" x="0" y="0" width="1" height="1" color-interpolation-filters="sRGB">
|
|
32
|
+
<feOffset in="SourceGraphic" dy="0" result="s"/>
|
|
33
|
+
<feColorMatrix in="s" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0" result="a"/>
|
|
34
|
+
<feComposite in="SourceGraphic" in2="a" operator="in"/>
|
|
35
|
+
</filter>
|
|
36
|
+
</defs>
|
|
37
|
+
<foreignObject width="1" height="1" filter="url(#${e(this,C)})">
|
|
38
|
+
<video></video>
|
|
39
|
+
</foreignObject>
|
|
40
|
+
</svg>`,h(this,x,t.querySelector("svg")),h(this,w,t.querySelector("foreignObject")),h(this,k,t.querySelector("filter")),h(this,L,t.querySelector("feOffset")),h(this,i,t.querySelector("video"));for(const s of at)e(this,i).addEventListener(s,n=>{this.dispatchEvent(new Event(n.type,{bubbles:!1,cancelable:!1}))});e(this,i).addEventListener("loadedmetadata",()=>c(this,b,M).call(this)),e(this,i).addEventListener("resize",()=>c(this,b,M).call(this))}connectedCallback(){for(const t of X)this.hasAttribute(t)&&c(this,b,I).call(this,t,this.getAttribute(t));c(this,b,H).call(this),h(this,T,new MutationObserver(()=>c(this,b,H).call(this))),e(this,T).observe(this,{childList:!0})}disconnectedCallback(){var t;(t=e(this,T))==null||t.disconnect(),h(this,T,null)}attributeChangedCallback(t,s,n){c(this,b,I).call(this,t,n)}get src(){return e(this,i).src}set src(t){this.setAttribute("src",t)}get currentSrc(){return e(this,i).currentSrc}get currentTime(){return e(this,i).currentTime}set currentTime(t){e(this,i).currentTime=t}get duration(){return e(this,i).duration}get paused(){return e(this,i).paused}get ended(){return e(this,i).ended}get readyState(){return e(this,i).readyState}get videoWidth(){return e(this,i).videoWidth}get videoHeight(){return Math.floor(e(this,i).videoHeight/2)}get volume(){return e(this,i).volume}set volume(t){e(this,i).volume=t}get playbackRate(){return e(this,i).playbackRate}set playbackRate(t){e(this,i).playbackRate=t}get defaultPlaybackRate(){return e(this,i).defaultPlaybackRate}set defaultPlaybackRate(t){e(this,i).defaultPlaybackRate=t}get muted(){return e(this,i).muted}set muted(t){e(this,i).muted=t,this.toggleAttribute("muted",t)}get loop(){return e(this,i).loop}set loop(t){e(this,i).loop=t,this.toggleAttribute("loop",t)}get autoplay(){return e(this,i).autoplay}set autoplay(t){e(this,i).autoplay=t,this.toggleAttribute("autoplay",t)}get preload(){return e(this,i).preload}set preload(t){this.setAttribute("preload",t)}get crossOrigin(){return e(this,i).crossOrigin}set crossOrigin(t){t===null?this.removeAttribute("crossorigin"):this.setAttribute("crossorigin",t)}get buffered(){return e(this,i).buffered}get seekable(){return e(this,i).seekable}get played(){return e(this,i).played}get networkState(){return e(this,i).networkState}get error(){return e(this,i).error}get seeking(){return e(this,i).seeking}play(){return e(this,i).play()}pause(){e(this,i).pause()}load(){e(this,i).load()}canPlayType(t){return e(this,i).canPlayType(t)}}i=new WeakMap,x=new WeakMap,w=new WeakMap,k=new WeakMap,L=new WeakMap,T=new WeakMap,C=new WeakMap,b=new WeakSet,M=function(){const t=e(this,i).videoWidth,s=e(this,i).videoHeight;if(!t||!s)return;const n=Math.floor(s/2);e(this,x).setAttribute("viewBox",`0 0 ${t} ${n}`),e(this,w).setAttribute("width",String(t)),e(this,w).setAttribute("height",String(s)),e(this,k).setAttribute("width",String(t)),e(this,k).setAttribute("height",String(s)),e(this,L).setAttribute("dy",String(-n))},I=function(t,s){ot.has(t)?e(this,i)[t]=s!==null:s===null?e(this,i).removeAttribute(t):e(this,i).setAttribute(t,s)},H=function(){e(this,i).querySelectorAll("source").forEach(t=>t.remove()),this.querySelectorAll("source").forEach(t=>{e(this,i).appendChild(t.cloneNode(!0))}),e(this,i).querySelectorAll("source").length>0&&!e(this,i).src&&e(this,i).load()},F(K,"observedAttributes",[...X]);const $=["src","crossorigin","preload","autoplay","loop","muted","playsinline","poster","width","height"],nt=new Set(["autoplay","loop","muted","playsinline"]),ht=["loadstart","progress","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","play","pause","ratechange","resize","volumechange"];var r,y,P,R,_,v,A,E,m,u,q,U,N,Q,O,B;class J extends HTMLElement{constructor(){super();d(this,u);d(this,r);d(this,y);d(this,P);d(this,R,null);d(this,_,null);d(this,v,!1);d(this,A,0);d(this,E,0);d(this,m,null);const t=this.attachShadow({mode:"open"});t.innerHTML=`<style>
|
|
41
|
+
:host{display:inline-block;overflow:hidden}
|
|
42
|
+
video{position:absolute;opacity:0;pointer-events:none;width:0;height:0}
|
|
43
|
+
canvas{display:block;width:100%}
|
|
44
|
+
</style>
|
|
45
|
+
<video></video>
|
|
46
|
+
<canvas></canvas>`,h(this,r,t.querySelector("video")),h(this,y,t.querySelector("canvas")),h(this,P,e(this,y).getContext("2d"));for(const s of ht)e(this,r).addEventListener(s,n=>{this.dispatchEvent(new Event(n.type,{bubbles:!1,cancelable:!1}))});e(this,r).addEventListener("loadedmetadata",()=>c(this,u,q).call(this)),e(this,r).addEventListener("resize",()=>c(this,u,q).call(this))}connectedCallback(){for(const t of $)this.hasAttribute(t)&&c(this,u,U).call(this,t,this.getAttribute(t));c(this,u,N).call(this),h(this,_,new MutationObserver(()=>c(this,u,N).call(this))),e(this,_).observe(this,{childList:!0}),h(this,m,z()),h(this,R,new IntersectionObserver(([t])=>{h(this,v,t.isIntersecting),e(this,v)?c(this,u,Q).call(this):c(this,u,O).call(this)},{threshold:0})),e(this,R).observe(this)}disconnectedCallback(){var t,s;c(this,u,O).call(this),(t=e(this,R))==null||t.disconnect(),h(this,R,null),(s=e(this,_))==null||s.disconnect(),h(this,_,null),e(this,m)&&(j(e(this,m)),h(this,m,null))}attributeChangedCallback(t,s,n){c(this,u,U).call(this,t,n)}get src(){return e(this,r).src}set src(t){this.setAttribute("src",t)}get currentSrc(){return e(this,r).currentSrc}get currentTime(){return e(this,r).currentTime}set currentTime(t){e(this,r).currentTime=t}get duration(){return e(this,r).duration}get paused(){return e(this,r).paused}get ended(){return e(this,r).ended}get readyState(){return e(this,r).readyState}get videoWidth(){return e(this,r).videoWidth}get videoHeight(){return Math.floor(e(this,r).videoHeight/2)}get volume(){return e(this,r).volume}set volume(t){e(this,r).volume=t}get playbackRate(){return e(this,r).playbackRate}set playbackRate(t){e(this,r).playbackRate=t}get defaultPlaybackRate(){return e(this,r).defaultPlaybackRate}set defaultPlaybackRate(t){e(this,r).defaultPlaybackRate=t}get muted(){return e(this,r).muted}set muted(t){e(this,r).muted=t,this.toggleAttribute("muted",t)}get loop(){return e(this,r).loop}set loop(t){e(this,r).loop=t,this.toggleAttribute("loop",t)}get autoplay(){return e(this,r).autoplay}set autoplay(t){e(this,r).autoplay=t,this.toggleAttribute("autoplay",t)}get preload(){return e(this,r).preload}set preload(t){this.setAttribute("preload",t)}get crossOrigin(){return e(this,r).crossOrigin}set crossOrigin(t){t===null?this.removeAttribute("crossorigin"):this.setAttribute("crossorigin",t)}get buffered(){return e(this,r).buffered}get seekable(){return e(this,r).seekable}get played(){return e(this,r).played}get networkState(){return e(this,r).networkState}get error(){return e(this,r).error}get seeking(){return e(this,r).seeking}play(){return e(this,r).play()}pause(){e(this,r).pause()}load(){e(this,r).load()}canPlayType(t){return e(this,r).canPlayType(t)}}r=new WeakMap,y=new WeakMap,P=new WeakMap,R=new WeakMap,_=new WeakMap,v=new WeakMap,A=new WeakMap,E=new WeakMap,m=new WeakMap,u=new WeakSet,q=function(){const t=e(this,r).videoWidth,s=e(this,r).videoHeight;if(!t||!s)return;const n=Math.floor(s/2);e(this,y).width=t,e(this,y).height=n},U=function(t,s){nt.has(t)?e(this,r)[t]=s!==null:s===null?e(this,r).removeAttribute(t):e(this,r).setAttribute(t,s)},N=function(){e(this,r).querySelectorAll("source").forEach(t=>t.remove()),this.querySelectorAll("source").forEach(t=>{e(this,r).appendChild(t.cloneNode(!0))}),e(this,r).querySelectorAll("source").length>0&&!e(this,r).src&&e(this,r).load()},Q=function(){if(e(this,v))if(c(this,u,O).call(this),"requestVideoFrameCallback"in e(this,r)){const t=()=>{e(this,v)&&(c(this,u,B).call(this),h(this,E,e(this,r).requestVideoFrameCallback(t)))};h(this,E,e(this,r).requestVideoFrameCallback(t))}else{const t=()=>{e(this,v)&&(c(this,u,B).call(this),h(this,A,requestAnimationFrame(t)))};h(this,A,requestAnimationFrame(t))}},O=function(){var t,s;e(this,E)&&((s=(t=e(this,r)).cancelVideoFrameCallback)==null||s.call(t,e(this,E)),h(this,E,0)),e(this,A)&&(cancelAnimationFrame(e(this,A)),h(this,A,0))},B=function(){if(e(this,r).readyState<2||!e(this,m))return;const t=e(this,r).videoWidth,s=e(this,r).videoHeight;!t||!s||Y(e(this,m),e(this,r),e(this,y),e(this,P))},F(J,"observedAttributes",[...$]);exports.AlphaVideoKitCanvas=J;exports.AlphaVideoKitSVG=K;exports.acquire=z;exports.processFrame=Y;exports.release=j;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./canvas-component-DduUMloe.cjs");function o(t){const{canvas:a}=t,l=a.getContext("2d");let n=e.acquire(),r=!1;return{drawFrame(i){r||e.processFrame(n,i,a,l)},setPremultipliedAlpha(i){},destroy(){r||(r=!0,e.release(n))},get isDestroyed(){return r}}}function s(t){return o(t)}exports.AlphaVideoKitCanvas=e.AlphaVideoKitCanvas;exports.AlphaVideoKitSVG=e.AlphaVideoKitSVG;exports.createRenderer=s;exports.createSvgFilterRenderer=o;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `<alpha-video-kit-canvas>` — Canvas 2D
|
|
2
|
+
* `<alpha-video-kit-canvas>` — Canvas 2D output powered by a shared WebGL processor.
|
|
3
3
|
*
|
|
4
|
-
* A hidden <video> feeds frames
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* A hidden <video> feeds frames through a shared WebGL canvas (singleton)
|
|
5
|
+
* that composites stacked-alpha halves via a shader, then copies the result
|
|
6
|
+
* to the visible <canvas> via drawImage. This avoids the 16 WebGL context
|
|
7
|
+
* limit and works in Safari.
|
|
8
8
|
*/
|
|
9
9
|
export declare class AlphaVideoKitCanvas extends HTMLElement {
|
|
10
10
|
#private;
|
|
11
|
-
static observedAttributes: ("
|
|
11
|
+
static observedAttributes: ("src" | "crossorigin" | "preload" | "autoplay" | "loop" | "muted" | "playsinline" | "poster" | "width" | "height")[];
|
|
12
12
|
constructor();
|
|
13
13
|
connectedCallback(): void;
|
|
14
14
|
disconnectedCallback(): void;
|
|
@@ -66,7 +66,7 @@ export declare class AlphaVideoKitCanvas extends HTMLElement {
|
|
|
66
66
|
*/
|
|
67
67
|
export declare class AlphaVideoKitSVG extends HTMLElement {
|
|
68
68
|
#private;
|
|
69
|
-
static observedAttributes: ("
|
|
69
|
+
static observedAttributes: ("src" | "crossorigin" | "preload" | "autoplay" | "loop" | "muted" | "playsinline" | "poster" | "width" | "height")[];
|
|
70
70
|
constructor();
|
|
71
71
|
connectedCallback(): void;
|
|
72
72
|
disconnectedCallback(): void;
|
|
@@ -113,11 +113,11 @@ export declare class AlphaVideoKitSVG extends HTMLElement {
|
|
|
113
113
|
export declare function createRenderer(options: StackedAlphaRendererOptions): StackedAlphaRenderer;
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
116
|
+
* Renderer that uses a shared WebGL canvas for alpha compositing,
|
|
117
|
+
* then copies the result to the user's 2D canvas.
|
|
117
118
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* to the visible canvas.
|
|
119
|
+
* This avoids the 16 WebGL context limit (single shared context)
|
|
120
|
+
* and works in Safari (unlike ctx.filter with SVG url() references).
|
|
121
121
|
*/
|
|
122
122
|
export declare function createSvgFilterRenderer(options: StackedAlphaRendererOptions): StackedAlphaRenderer;
|
|
123
123
|
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
const { canvas:
|
|
5
|
-
let
|
|
6
|
-
function b() {
|
|
7
|
-
if (s) return;
|
|
8
|
-
const r = document.createElementNS(o, "svg");
|
|
9
|
-
r.setAttribute("width", "0"), r.setAttribute("height", "0"), r.style.cssText = "position:absolute;overflow:hidden";
|
|
10
|
-
const i = document.createElementNS(o, "defs"), t = document.createElementNS(o, "filter");
|
|
11
|
-
t.id = p, t.setAttribute("filterUnits", "userSpaceOnUse"), t.setAttribute("x", "0"), t.setAttribute("y", "0"), t.setAttribute("width", "1"), t.setAttribute("height", "1"), t.setAttribute("color-interpolation-filters", "sRGB");
|
|
12
|
-
const e = document.createElementNS(o, "feOffset");
|
|
13
|
-
e.setAttribute("in", "SourceGraphic"), e.setAttribute("dy", "0"), e.setAttribute("result", "s");
|
|
14
|
-
const l = document.createElementNS(o, "feColorMatrix");
|
|
15
|
-
l.setAttribute("in", "s"), l.setAttribute("type", "matrix"), l.setAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"), l.setAttribute("result", "a");
|
|
16
|
-
const d = document.createElementNS(o, "feComposite");
|
|
17
|
-
d.setAttribute("in", "SourceGraphic"), d.setAttribute("in2", "a"), d.setAttribute("operator", "in"), t.append(e, l, d), i.appendChild(t), r.appendChild(i), document.body.appendChild(r), s = r, c = t, h = e;
|
|
18
|
-
}
|
|
1
|
+
import { a as o, r as i, p as l } from "./canvas-component-DRs32j73.js";
|
|
2
|
+
import { A as m, b as x } from "./canvas-component-DRs32j73.js";
|
|
3
|
+
function d(r) {
|
|
4
|
+
const { canvas: t } = r, n = t.getContext("2d");
|
|
5
|
+
let a = o(), e = !1;
|
|
19
6
|
return {
|
|
20
|
-
drawFrame(
|
|
21
|
-
|
|
22
|
-
const i = r.videoWidth, t = r.videoHeight, e = Math.floor(t / 2);
|
|
23
|
-
(u.width !== i || u.height !== e) && (u.width = i, u.height = e), (n.width !== i || n.height !== t) && (n.width = i, n.height = t), b(), c.setAttribute("width", String(i)), c.setAttribute("height", String(t)), h.setAttribute("dy", String(-e)), A.filter = `url(#${p})`, A.drawImage(r, 0, 0), m.clearRect(0, 0, i, e), m.drawImage(n, 0, 0, i, e, 0, 0, i, e);
|
|
7
|
+
drawFrame(s) {
|
|
8
|
+
e || l(a, s, t, n);
|
|
24
9
|
},
|
|
25
|
-
setPremultipliedAlpha(
|
|
10
|
+
setPremultipliedAlpha(s) {
|
|
26
11
|
},
|
|
27
12
|
destroy() {
|
|
28
|
-
|
|
13
|
+
e || (e = !0, i(a));
|
|
29
14
|
},
|
|
30
15
|
get isDestroyed() {
|
|
31
|
-
return
|
|
16
|
+
return e;
|
|
32
17
|
}
|
|
33
18
|
};
|
|
34
19
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
20
|
+
function c(r) {
|
|
21
|
+
return d(r);
|
|
37
22
|
}
|
|
38
23
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
m as AlphaVideoKitCanvas,
|
|
25
|
+
x as AlphaVideoKitSVG,
|
|
26
|
+
c as createRenderer,
|
|
27
|
+
d as createSvgFilterRenderer
|
|
43
28
|
};
|
package/dist/register.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./canvas-component-
|
|
1
|
+
"use strict";const e=require("./canvas-component-DduUMloe.cjs");customElements.get("alpha-video-kit-svg")||customElements.define("alpha-video-kit-svg",e.AlphaVideoKitSVG);customElements.get("alpha-video-kit-canvas")||customElements.define("alpha-video-kit-canvas",e.AlphaVideoKitCanvas);
|
package/dist/register.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as e, A as a } from "./canvas-component-DRs32j73.js";
|
|
2
2
|
customElements.get("alpha-video-kit-svg") || customElements.define("alpha-video-kit-svg", e);
|
|
3
3
|
customElements.get("alpha-video-kit-canvas") || customElements.define("alpha-video-kit-canvas", a);
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";var tt=Object.defineProperty;var j=n=>{throw TypeError(n)};var et=(n,l,t)=>l in n?tt(n,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[l]=t;var F=(n,l,t)=>et(n,typeof l!="symbol"?l+"":l,t),$=(n,l,t)=>l.has(n)||j("Cannot "+t);var e=(n,l,t)=>($(n,l,"read from private field"),t?t.call(n):l.get(n)),u=(n,l,t)=>l.has(n)?j("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,t),a=(n,l,t,r)=>($(n,l,"write to private field"),r?r.call(n,t):l.set(n,t),t),d=(n,l,t)=>($(n,l,"access private method"),t);const K=["src","crossorigin","preload","autoplay","loop","muted","playsinline","poster","width","height"],it=new Set(["autoplay","loop","muted","playsinline"]),st=["loadstart","progress","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","play","pause","ratechange","resize","volumechange"];var s,L,E,O,N,y,C,c,_,G,W;class J extends HTMLElement{constructor(){super();u(this,c);u(this,s);u(this,L);u(this,E);u(this,O);u(this,N);u(this,y,null);u(this,C);const t=this.attachShadow({mode:"open"});a(this,C,`avk-${Math.random().toString(36).slice(2,8)}`),t.innerHTML=`<style>
|
|
2
|
-
:host{display:inline-block;overflow:hidden}
|
|
3
|
-
svg{display:block;width:100%;height:auto}
|
|
4
|
-
video{display:block;width:100%;height:100%}
|
|
5
|
-
</style>
|
|
6
|
-
<svg viewBox="0 0 1 1" preserveAspectRatio="xMidYMid meet">
|
|
7
|
-
<defs>
|
|
8
|
-
<filter id="${e(this,C)}" filterUnits="userSpaceOnUse" x="0" y="0" width="1" height="1" color-interpolation-filters="sRGB">
|
|
9
|
-
<feOffset in="SourceGraphic" dy="0" result="s"/>
|
|
10
|
-
<feColorMatrix in="s" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0" result="a"/>
|
|
11
|
-
<feComposite in="SourceGraphic" in2="a" operator="in"/>
|
|
12
|
-
</filter>
|
|
13
|
-
</defs>
|
|
14
|
-
<foreignObject width="1" height="1" filter="url(#${e(this,C)})">
|
|
15
|
-
<video></video>
|
|
16
|
-
</foreignObject>
|
|
17
|
-
</svg>`,a(this,L,t.querySelector("svg")),a(this,E,t.querySelector("foreignObject")),a(this,O,t.querySelector("filter")),a(this,N,t.querySelector("feOffset")),a(this,s,t.querySelector("video"));for(const r of st)e(this,s).addEventListener(r,o=>{this.dispatchEvent(new Event(o.type,{bubbles:!1,cancelable:!1}))});e(this,s).addEventListener("loadedmetadata",()=>d(this,c,_).call(this)),e(this,s).addEventListener("resize",()=>d(this,c,_).call(this))}connectedCallback(){for(const t of K)this.hasAttribute(t)&&d(this,c,G).call(this,t,this.getAttribute(t));d(this,c,W).call(this),a(this,y,new MutationObserver(()=>d(this,c,W).call(this))),e(this,y).observe(this,{childList:!0})}disconnectedCallback(){var t;(t=e(this,y))==null||t.disconnect(),a(this,y,null)}attributeChangedCallback(t,r,o){d(this,c,G).call(this,t,o)}get src(){return e(this,s).src}set src(t){this.setAttribute("src",t)}get currentSrc(){return e(this,s).currentSrc}get currentTime(){return e(this,s).currentTime}set currentTime(t){e(this,s).currentTime=t}get duration(){return e(this,s).duration}get paused(){return e(this,s).paused}get ended(){return e(this,s).ended}get readyState(){return e(this,s).readyState}get videoWidth(){return e(this,s).videoWidth}get videoHeight(){return Math.floor(e(this,s).videoHeight/2)}get volume(){return e(this,s).volume}set volume(t){e(this,s).volume=t}get playbackRate(){return e(this,s).playbackRate}set playbackRate(t){e(this,s).playbackRate=t}get defaultPlaybackRate(){return e(this,s).defaultPlaybackRate}set defaultPlaybackRate(t){e(this,s).defaultPlaybackRate=t}get muted(){return e(this,s).muted}set muted(t){e(this,s).muted=t,this.toggleAttribute("muted",t)}get loop(){return e(this,s).loop}set loop(t){e(this,s).loop=t,this.toggleAttribute("loop",t)}get autoplay(){return e(this,s).autoplay}set autoplay(t){e(this,s).autoplay=t,this.toggleAttribute("autoplay",t)}get preload(){return e(this,s).preload}set preload(t){this.setAttribute("preload",t)}get crossOrigin(){return e(this,s).crossOrigin}set crossOrigin(t){t===null?this.removeAttribute("crossorigin"):this.setAttribute("crossorigin",t)}get buffered(){return e(this,s).buffered}get seekable(){return e(this,s).seekable}get played(){return e(this,s).played}get networkState(){return e(this,s).networkState}get error(){return e(this,s).error}get seeking(){return e(this,s).seeking}play(){return e(this,s).play()}pause(){e(this,s).pause()}load(){e(this,s).load()}canPlayType(t){return e(this,s).canPlayType(t)}}s=new WeakMap,L=new WeakMap,E=new WeakMap,O=new WeakMap,N=new WeakMap,y=new WeakMap,C=new WeakMap,c=new WeakSet,_=function(){const t=e(this,s).videoWidth,r=e(this,s).videoHeight;if(!t||!r)return;const o=Math.floor(r/2);e(this,L).setAttribute("viewBox",`0 0 ${t} ${o}`),e(this,E).setAttribute("width",String(t)),e(this,E).setAttribute("height",String(r)),e(this,O).setAttribute("width",String(t)),e(this,O).setAttribute("height",String(r)),e(this,N).setAttribute("dy",String(-o))},G=function(t,r){it.has(t)?e(this,s)[t]=r!==null:r===null?e(this,s).removeAttribute(t):e(this,s).setAttribute(t,r)},W=function(){e(this,s).querySelectorAll("source").forEach(t=>t.remove()),this.querySelectorAll("source").forEach(t=>{e(this,s).appendChild(t.cloneNode(!0))}),e(this,s).querySelectorAll("source").length>0&&!e(this,s).src&&e(this,s).load()},F(J,"observedAttributes",[...K]);const w="http://www.w3.org/2000/svg",Y=["src","crossorigin","preload","autoplay","loop","muted","playsinline","poster","width","height"],rt=new Set(["autoplay","loop","muted","playsinline"]),at=["loadstart","progress","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","play","pause","ratechange","resize","volumechange"];var i,m,T,g,R,v,A,p,b,f,M,S,k,q,h,B,X,I,D,z,Z,P,U;class Q extends HTMLElement{constructor(){super();u(this,h);u(this,i);u(this,m);u(this,T);u(this,g);u(this,R);u(this,v,null);u(this,A,null);u(this,p,!1);u(this,b,0);u(this,f,0);u(this,M);u(this,S,null);u(this,k,null);u(this,q,null);const t=this.attachShadow({mode:"open"});a(this,M,`avk-c-${Math.random().toString(36).slice(2,8)}`),t.innerHTML=`<style>
|
|
18
|
-
:host{display:inline-block;overflow:hidden}
|
|
19
|
-
video{position:absolute;opacity:0;pointer-events:none;width:0;height:0}
|
|
20
|
-
canvas{display:block;width:100%}
|
|
21
|
-
</style>
|
|
22
|
-
<video></video>
|
|
23
|
-
<canvas></canvas>`,a(this,i,t.querySelector("video")),a(this,m,t.querySelector("canvas")),a(this,T,e(this,m).getContext("2d")),a(this,g,document.createElement("canvas")),a(this,R,e(this,g).getContext("2d"));for(const r of at)e(this,i).addEventListener(r,o=>{this.dispatchEvent(new Event(o.type,{bubbles:!1,cancelable:!1}))});e(this,i).addEventListener("loadedmetadata",()=>d(this,h,I).call(this)),e(this,i).addEventListener("resize",()=>d(this,h,I).call(this))}connectedCallback(){for(const t of Y)this.hasAttribute(t)&&d(this,h,D).call(this,t,this.getAttribute(t));d(this,h,z).call(this),a(this,A,new MutationObserver(()=>d(this,h,z).call(this))),e(this,A).observe(this,{childList:!0}),d(this,h,B).call(this),a(this,v,new IntersectionObserver(([t])=>{a(this,p,t.isIntersecting),e(this,p)?d(this,h,Z).call(this):d(this,h,P).call(this)},{threshold:0})),e(this,v).observe(this)}disconnectedCallback(){var t,r;d(this,h,P).call(this),(t=e(this,v))==null||t.disconnect(),a(this,v,null),(r=e(this,A))==null||r.disconnect(),a(this,A,null),d(this,h,X).call(this)}attributeChangedCallback(t,r,o){d(this,h,D).call(this,t,o)}get src(){return e(this,i).src}set src(t){this.setAttribute("src",t)}get currentSrc(){return e(this,i).currentSrc}get currentTime(){return e(this,i).currentTime}set currentTime(t){e(this,i).currentTime=t}get duration(){return e(this,i).duration}get paused(){return e(this,i).paused}get ended(){return e(this,i).ended}get readyState(){return e(this,i).readyState}get videoWidth(){return e(this,i).videoWidth}get videoHeight(){return Math.floor(e(this,i).videoHeight/2)}get volume(){return e(this,i).volume}set volume(t){e(this,i).volume=t}get playbackRate(){return e(this,i).playbackRate}set playbackRate(t){e(this,i).playbackRate=t}get defaultPlaybackRate(){return e(this,i).defaultPlaybackRate}set defaultPlaybackRate(t){e(this,i).defaultPlaybackRate=t}get muted(){return e(this,i).muted}set muted(t){e(this,i).muted=t,this.toggleAttribute("muted",t)}get loop(){return e(this,i).loop}set loop(t){e(this,i).loop=t,this.toggleAttribute("loop",t)}get autoplay(){return e(this,i).autoplay}set autoplay(t){e(this,i).autoplay=t,this.toggleAttribute("autoplay",t)}get preload(){return e(this,i).preload}set preload(t){this.setAttribute("preload",t)}get crossOrigin(){return e(this,i).crossOrigin}set crossOrigin(t){t===null?this.removeAttribute("crossorigin"):this.setAttribute("crossorigin",t)}get buffered(){return e(this,i).buffered}get seekable(){return e(this,i).seekable}get played(){return e(this,i).played}get networkState(){return e(this,i).networkState}get error(){return e(this,i).error}get seeking(){return e(this,i).seeking}play(){return e(this,i).play()}pause(){e(this,i).pause()}load(){e(this,i).load()}canPlayType(t){return e(this,i).canPlayType(t)}}i=new WeakMap,m=new WeakMap,T=new WeakMap,g=new WeakMap,R=new WeakMap,v=new WeakMap,A=new WeakMap,p=new WeakMap,b=new WeakMap,f=new WeakMap,M=new WeakMap,S=new WeakMap,k=new WeakMap,q=new WeakMap,h=new WeakSet,B=function(){if(e(this,S))return;const t=document.createElementNS(w,"svg");t.setAttribute("width","0"),t.setAttribute("height","0"),t.style.cssText="position:absolute;overflow:hidden";const r=document.createElementNS(w,"defs"),o=document.createElementNS(w,"filter");o.id=e(this,M),o.setAttribute("filterUnits","userSpaceOnUse"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("width","1"),o.setAttribute("height","1"),o.setAttribute("color-interpolation-filters","sRGB");const H=document.createElementNS(w,"feOffset");H.setAttribute("in","SourceGraphic"),H.setAttribute("dy","0"),H.setAttribute("result","s");const x=document.createElementNS(w,"feColorMatrix");x.setAttribute("in","s"),x.setAttribute("type","matrix"),x.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"),x.setAttribute("result","a");const V=document.createElementNS(w,"feComposite");V.setAttribute("in","SourceGraphic"),V.setAttribute("in2","a"),V.setAttribute("operator","in"),o.append(H,x,V),r.appendChild(o),t.appendChild(r),document.body.appendChild(t),a(this,S,t),a(this,k,o),a(this,q,H)},X=function(){var t;(t=e(this,S))==null||t.remove(),a(this,S,null),a(this,k,null),a(this,q,null)},I=function(){const t=e(this,i).videoWidth,r=e(this,i).videoHeight;if(!t||!r)return;const o=Math.floor(r/2);e(this,m).width=t,e(this,m).height=o,e(this,g).width=t,e(this,g).height=r,d(this,h,B).call(this),e(this,k).setAttribute("width",String(t)),e(this,k).setAttribute("height",String(r)),e(this,q).setAttribute("dy",String(-o))},D=function(t,r){rt.has(t)?e(this,i)[t]=r!==null:r===null?e(this,i).removeAttribute(t):e(this,i).setAttribute(t,r)},z=function(){e(this,i).querySelectorAll("source").forEach(t=>t.remove()),this.querySelectorAll("source").forEach(t=>{e(this,i).appendChild(t.cloneNode(!0))}),e(this,i).querySelectorAll("source").length>0&&!e(this,i).src&&e(this,i).load()},Z=function(){if(e(this,p))if(d(this,h,P).call(this),"requestVideoFrameCallback"in e(this,i)){const t=()=>{e(this,p)&&(d(this,h,U).call(this),a(this,f,e(this,i).requestVideoFrameCallback(t)))};a(this,f,e(this,i).requestVideoFrameCallback(t))}else{const t=()=>{e(this,p)&&(d(this,h,U).call(this),a(this,b,requestAnimationFrame(t)))};a(this,b,requestAnimationFrame(t))}},P=function(){var t,r;e(this,f)&&((r=(t=e(this,i)).cancelVideoFrameCallback)==null||r.call(t,e(this,f)),a(this,f,0)),e(this,b)&&(cancelAnimationFrame(e(this,b)),a(this,b,0))},U=function(){if(e(this,i).readyState<2)return;const t=e(this,i).videoWidth,r=e(this,i).videoHeight;if(!t||!r)return;const o=Math.floor(r/2);(e(this,g).width!==t||e(this,g).height!==r)&&d(this,h,I).call(this),e(this,R).filter=`url(#${e(this,M)})`,e(this,R).drawImage(e(this,i),0,0),e(this,T).clearRect(0,0,t,o),e(this,T).drawImage(e(this,g),0,0,t,o,0,0,t,o)},F(Q,"observedAttributes",[...Y]);exports.AlphaVideoKitCanvas=Q;exports.AlphaVideoKitSVG=J;
|
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
var X = Object.defineProperty;
|
|
2
|
-
var j = (n) => {
|
|
3
|
-
throw TypeError(n);
|
|
4
|
-
};
|
|
5
|
-
var Z = (n, l, t) => l in n ? X(n, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[l] = t;
|
|
6
|
-
var V = (n, l, t) => Z(n, typeof l != "symbol" ? l + "" : l, t), $ = (n, l, t) => l.has(n) || j("Cannot " + t);
|
|
7
|
-
var e = (n, l, t) => ($(n, l, "read from private field"), t ? t.call(n) : l.get(n)), u = (n, l, t) => l.has(n) ? j("Cannot add the same private member more than once") : l instanceof WeakSet ? l.add(n) : l.set(n, t), a = (n, l, t, r) => ($(n, l, "write to private field"), r ? r.call(n, t) : l.set(n, t), t), d = (n, l, t) => ($(n, l, "access private method"), t);
|
|
8
|
-
const Y = [
|
|
9
|
-
"src",
|
|
10
|
-
"crossorigin",
|
|
11
|
-
"preload",
|
|
12
|
-
"autoplay",
|
|
13
|
-
"loop",
|
|
14
|
-
"muted",
|
|
15
|
-
"playsinline",
|
|
16
|
-
"poster",
|
|
17
|
-
"width",
|
|
18
|
-
"height"
|
|
19
|
-
], tt = /* @__PURE__ */ new Set(["autoplay", "loop", "muted", "playsinline"]), et = [
|
|
20
|
-
"loadstart",
|
|
21
|
-
"progress",
|
|
22
|
-
"suspend",
|
|
23
|
-
"abort",
|
|
24
|
-
"error",
|
|
25
|
-
"emptied",
|
|
26
|
-
"stalled",
|
|
27
|
-
"loadedmetadata",
|
|
28
|
-
"loadeddata",
|
|
29
|
-
"canplay",
|
|
30
|
-
"canplaythrough",
|
|
31
|
-
"playing",
|
|
32
|
-
"waiting",
|
|
33
|
-
"seeking",
|
|
34
|
-
"seeked",
|
|
35
|
-
"ended",
|
|
36
|
-
"durationchange",
|
|
37
|
-
"timeupdate",
|
|
38
|
-
"play",
|
|
39
|
-
"pause",
|
|
40
|
-
"ratechange",
|
|
41
|
-
"resize",
|
|
42
|
-
"volumechange"
|
|
43
|
-
];
|
|
44
|
-
var s, L, E, O, N, y, T, c, _, G, W;
|
|
45
|
-
class it extends HTMLElement {
|
|
46
|
-
constructor() {
|
|
47
|
-
super();
|
|
48
|
-
u(this, c);
|
|
49
|
-
u(this, s);
|
|
50
|
-
u(this, L);
|
|
51
|
-
u(this, E);
|
|
52
|
-
u(this, O);
|
|
53
|
-
u(this, N);
|
|
54
|
-
u(this, y, null);
|
|
55
|
-
u(this, T);
|
|
56
|
-
const t = this.attachShadow({ mode: "open" });
|
|
57
|
-
a(this, T, `avk-${Math.random().toString(36).slice(2, 8)}`), t.innerHTML = `<style>
|
|
58
|
-
:host{display:inline-block;overflow:hidden}
|
|
59
|
-
svg{display:block;width:100%;height:auto}
|
|
60
|
-
video{display:block;width:100%;height:100%}
|
|
61
|
-
</style>
|
|
62
|
-
<svg viewBox="0 0 1 1" preserveAspectRatio="xMidYMid meet">
|
|
63
|
-
<defs>
|
|
64
|
-
<filter id="${e(this, T)}" filterUnits="userSpaceOnUse" x="0" y="0" width="1" height="1" color-interpolation-filters="sRGB">
|
|
65
|
-
<feOffset in="SourceGraphic" dy="0" result="s"/>
|
|
66
|
-
<feColorMatrix in="s" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0" result="a"/>
|
|
67
|
-
<feComposite in="SourceGraphic" in2="a" operator="in"/>
|
|
68
|
-
</filter>
|
|
69
|
-
</defs>
|
|
70
|
-
<foreignObject width="1" height="1" filter="url(#${e(this, T)})">
|
|
71
|
-
<video></video>
|
|
72
|
-
</foreignObject>
|
|
73
|
-
</svg>`, a(this, L, t.querySelector("svg")), a(this, E, t.querySelector("foreignObject")), a(this, O, t.querySelector("filter")), a(this, N, t.querySelector("feOffset")), a(this, s, t.querySelector("video"));
|
|
74
|
-
for (const r of et)
|
|
75
|
-
e(this, s).addEventListener(r, (o) => {
|
|
76
|
-
this.dispatchEvent(new Event(o.type, { bubbles: !1, cancelable: !1 }));
|
|
77
|
-
});
|
|
78
|
-
e(this, s).addEventListener("loadedmetadata", () => d(this, c, _).call(this)), e(this, s).addEventListener("resize", () => d(this, c, _).call(this));
|
|
79
|
-
}
|
|
80
|
-
connectedCallback() {
|
|
81
|
-
for (const t of Y)
|
|
82
|
-
this.hasAttribute(t) && d(this, c, G).call(this, t, this.getAttribute(t));
|
|
83
|
-
d(this, c, W).call(this), a(this, y, new MutationObserver(() => d(this, c, W).call(this))), e(this, y).observe(this, { childList: !0 });
|
|
84
|
-
}
|
|
85
|
-
disconnectedCallback() {
|
|
86
|
-
var t;
|
|
87
|
-
(t = e(this, y)) == null || t.disconnect(), a(this, y, null);
|
|
88
|
-
}
|
|
89
|
-
attributeChangedCallback(t, r, o) {
|
|
90
|
-
d(this, c, G).call(this, t, o);
|
|
91
|
-
}
|
|
92
|
-
// --- Proxied properties ---
|
|
93
|
-
get src() {
|
|
94
|
-
return e(this, s).src;
|
|
95
|
-
}
|
|
96
|
-
set src(t) {
|
|
97
|
-
this.setAttribute("src", t);
|
|
98
|
-
}
|
|
99
|
-
get currentSrc() {
|
|
100
|
-
return e(this, s).currentSrc;
|
|
101
|
-
}
|
|
102
|
-
get currentTime() {
|
|
103
|
-
return e(this, s).currentTime;
|
|
104
|
-
}
|
|
105
|
-
set currentTime(t) {
|
|
106
|
-
e(this, s).currentTime = t;
|
|
107
|
-
}
|
|
108
|
-
get duration() {
|
|
109
|
-
return e(this, s).duration;
|
|
110
|
-
}
|
|
111
|
-
get paused() {
|
|
112
|
-
return e(this, s).paused;
|
|
113
|
-
}
|
|
114
|
-
get ended() {
|
|
115
|
-
return e(this, s).ended;
|
|
116
|
-
}
|
|
117
|
-
get readyState() {
|
|
118
|
-
return e(this, s).readyState;
|
|
119
|
-
}
|
|
120
|
-
get videoWidth() {
|
|
121
|
-
return e(this, s).videoWidth;
|
|
122
|
-
}
|
|
123
|
-
get videoHeight() {
|
|
124
|
-
return Math.floor(e(this, s).videoHeight / 2);
|
|
125
|
-
}
|
|
126
|
-
get volume() {
|
|
127
|
-
return e(this, s).volume;
|
|
128
|
-
}
|
|
129
|
-
set volume(t) {
|
|
130
|
-
e(this, s).volume = t;
|
|
131
|
-
}
|
|
132
|
-
get playbackRate() {
|
|
133
|
-
return e(this, s).playbackRate;
|
|
134
|
-
}
|
|
135
|
-
set playbackRate(t) {
|
|
136
|
-
e(this, s).playbackRate = t;
|
|
137
|
-
}
|
|
138
|
-
get defaultPlaybackRate() {
|
|
139
|
-
return e(this, s).defaultPlaybackRate;
|
|
140
|
-
}
|
|
141
|
-
set defaultPlaybackRate(t) {
|
|
142
|
-
e(this, s).defaultPlaybackRate = t;
|
|
143
|
-
}
|
|
144
|
-
get muted() {
|
|
145
|
-
return e(this, s).muted;
|
|
146
|
-
}
|
|
147
|
-
set muted(t) {
|
|
148
|
-
e(this, s).muted = t, this.toggleAttribute("muted", t);
|
|
149
|
-
}
|
|
150
|
-
get loop() {
|
|
151
|
-
return e(this, s).loop;
|
|
152
|
-
}
|
|
153
|
-
set loop(t) {
|
|
154
|
-
e(this, s).loop = t, this.toggleAttribute("loop", t);
|
|
155
|
-
}
|
|
156
|
-
get autoplay() {
|
|
157
|
-
return e(this, s).autoplay;
|
|
158
|
-
}
|
|
159
|
-
set autoplay(t) {
|
|
160
|
-
e(this, s).autoplay = t, this.toggleAttribute("autoplay", t);
|
|
161
|
-
}
|
|
162
|
-
get preload() {
|
|
163
|
-
return e(this, s).preload;
|
|
164
|
-
}
|
|
165
|
-
set preload(t) {
|
|
166
|
-
this.setAttribute("preload", t);
|
|
167
|
-
}
|
|
168
|
-
get crossOrigin() {
|
|
169
|
-
return e(this, s).crossOrigin;
|
|
170
|
-
}
|
|
171
|
-
set crossOrigin(t) {
|
|
172
|
-
t === null ? this.removeAttribute("crossorigin") : this.setAttribute("crossorigin", t);
|
|
173
|
-
}
|
|
174
|
-
get buffered() {
|
|
175
|
-
return e(this, s).buffered;
|
|
176
|
-
}
|
|
177
|
-
get seekable() {
|
|
178
|
-
return e(this, s).seekable;
|
|
179
|
-
}
|
|
180
|
-
get played() {
|
|
181
|
-
return e(this, s).played;
|
|
182
|
-
}
|
|
183
|
-
get networkState() {
|
|
184
|
-
return e(this, s).networkState;
|
|
185
|
-
}
|
|
186
|
-
get error() {
|
|
187
|
-
return e(this, s).error;
|
|
188
|
-
}
|
|
189
|
-
get seeking() {
|
|
190
|
-
return e(this, s).seeking;
|
|
191
|
-
}
|
|
192
|
-
// --- Proxied methods ---
|
|
193
|
-
play() {
|
|
194
|
-
return e(this, s).play();
|
|
195
|
-
}
|
|
196
|
-
pause() {
|
|
197
|
-
e(this, s).pause();
|
|
198
|
-
}
|
|
199
|
-
load() {
|
|
200
|
-
e(this, s).load();
|
|
201
|
-
}
|
|
202
|
-
canPlayType(t) {
|
|
203
|
-
return e(this, s).canPlayType(t);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
s = new WeakMap(), L = new WeakMap(), E = new WeakMap(), O = new WeakMap(), N = new WeakMap(), y = new WeakMap(), T = new WeakMap(), c = new WeakSet(), _ = function() {
|
|
207
|
-
const t = e(this, s).videoWidth, r = e(this, s).videoHeight;
|
|
208
|
-
if (!t || !r) return;
|
|
209
|
-
const o = Math.floor(r / 2);
|
|
210
|
-
e(this, L).setAttribute("viewBox", `0 0 ${t} ${o}`), e(this, E).setAttribute("width", String(t)), e(this, E).setAttribute("height", String(r)), e(this, O).setAttribute("width", String(t)), e(this, O).setAttribute("height", String(r)), e(this, N).setAttribute("dy", String(-o));
|
|
211
|
-
}, G = function(t, r) {
|
|
212
|
-
tt.has(t) ? e(this, s)[t] = r !== null : r === null ? e(this, s).removeAttribute(t) : e(this, s).setAttribute(t, r);
|
|
213
|
-
}, W = function() {
|
|
214
|
-
e(this, s).querySelectorAll("source").forEach((t) => t.remove()), this.querySelectorAll("source").forEach((t) => {
|
|
215
|
-
e(this, s).appendChild(t.cloneNode(!0));
|
|
216
|
-
}), e(this, s).querySelectorAll("source").length > 0 && !e(this, s).src && e(this, s).load();
|
|
217
|
-
}, V(it, "observedAttributes", [...Y]);
|
|
218
|
-
const w = "http://www.w3.org/2000/svg", J = [
|
|
219
|
-
"src",
|
|
220
|
-
"crossorigin",
|
|
221
|
-
"preload",
|
|
222
|
-
"autoplay",
|
|
223
|
-
"loop",
|
|
224
|
-
"muted",
|
|
225
|
-
"playsinline",
|
|
226
|
-
"poster",
|
|
227
|
-
"width",
|
|
228
|
-
"height"
|
|
229
|
-
], st = /* @__PURE__ */ new Set(["autoplay", "loop", "muted", "playsinline"]), rt = [
|
|
230
|
-
"loadstart",
|
|
231
|
-
"progress",
|
|
232
|
-
"suspend",
|
|
233
|
-
"abort",
|
|
234
|
-
"error",
|
|
235
|
-
"emptied",
|
|
236
|
-
"stalled",
|
|
237
|
-
"loadedmetadata",
|
|
238
|
-
"loadeddata",
|
|
239
|
-
"canplay",
|
|
240
|
-
"canplaythrough",
|
|
241
|
-
"playing",
|
|
242
|
-
"waiting",
|
|
243
|
-
"seeking",
|
|
244
|
-
"seeked",
|
|
245
|
-
"ended",
|
|
246
|
-
"durationchange",
|
|
247
|
-
"timeupdate",
|
|
248
|
-
"play",
|
|
249
|
-
"pause",
|
|
250
|
-
"ratechange",
|
|
251
|
-
"resize",
|
|
252
|
-
"volumechange"
|
|
253
|
-
];
|
|
254
|
-
var i, m, C, g, R, v, A, p, b, f, M, S, k, q, h, B, K, P, D, z, Q, F, U;
|
|
255
|
-
class at extends HTMLElement {
|
|
256
|
-
constructor() {
|
|
257
|
-
super();
|
|
258
|
-
u(this, h);
|
|
259
|
-
u(this, i);
|
|
260
|
-
u(this, m);
|
|
261
|
-
u(this, C);
|
|
262
|
-
u(this, g);
|
|
263
|
-
u(this, R);
|
|
264
|
-
u(this, v, null);
|
|
265
|
-
u(this, A, null);
|
|
266
|
-
u(this, p, !1);
|
|
267
|
-
u(this, b, 0);
|
|
268
|
-
u(this, f, 0);
|
|
269
|
-
// SVG filter (lives in document.body so ctx.filter url() can resolve it)
|
|
270
|
-
u(this, M);
|
|
271
|
-
u(this, S, null);
|
|
272
|
-
u(this, k, null);
|
|
273
|
-
u(this, q, null);
|
|
274
|
-
const t = this.attachShadow({ mode: "open" });
|
|
275
|
-
a(this, M, `avk-c-${Math.random().toString(36).slice(2, 8)}`), t.innerHTML = `<style>
|
|
276
|
-
:host{display:inline-block;overflow:hidden}
|
|
277
|
-
video{position:absolute;opacity:0;pointer-events:none;width:0;height:0}
|
|
278
|
-
canvas{display:block;width:100%}
|
|
279
|
-
</style>
|
|
280
|
-
<video></video>
|
|
281
|
-
<canvas></canvas>`, a(this, i, t.querySelector("video")), a(this, m, t.querySelector("canvas")), a(this, C, e(this, m).getContext("2d")), a(this, g, document.createElement("canvas")), a(this, R, e(this, g).getContext("2d"));
|
|
282
|
-
for (const r of rt)
|
|
283
|
-
e(this, i).addEventListener(r, (o) => {
|
|
284
|
-
this.dispatchEvent(new Event(o.type, { bubbles: !1, cancelable: !1 }));
|
|
285
|
-
});
|
|
286
|
-
e(this, i).addEventListener("loadedmetadata", () => d(this, h, P).call(this)), e(this, i).addEventListener("resize", () => d(this, h, P).call(this));
|
|
287
|
-
}
|
|
288
|
-
connectedCallback() {
|
|
289
|
-
for (const t of J)
|
|
290
|
-
this.hasAttribute(t) && d(this, h, D).call(this, t, this.getAttribute(t));
|
|
291
|
-
d(this, h, z).call(this), a(this, A, new MutationObserver(() => d(this, h, z).call(this))), e(this, A).observe(this, { childList: !0 }), d(this, h, B).call(this), a(this, v, new IntersectionObserver(
|
|
292
|
-
([t]) => {
|
|
293
|
-
a(this, p, t.isIntersecting), e(this, p) ? d(this, h, Q).call(this) : d(this, h, F).call(this);
|
|
294
|
-
},
|
|
295
|
-
{ threshold: 0 }
|
|
296
|
-
)), e(this, v).observe(this);
|
|
297
|
-
}
|
|
298
|
-
disconnectedCallback() {
|
|
299
|
-
var t, r;
|
|
300
|
-
d(this, h, F).call(this), (t = e(this, v)) == null || t.disconnect(), a(this, v, null), (r = e(this, A)) == null || r.disconnect(), a(this, A, null), d(this, h, K).call(this);
|
|
301
|
-
}
|
|
302
|
-
attributeChangedCallback(t, r, o) {
|
|
303
|
-
d(this, h, D).call(this, t, o);
|
|
304
|
-
}
|
|
305
|
-
// --- Proxied properties ---
|
|
306
|
-
get src() {
|
|
307
|
-
return e(this, i).src;
|
|
308
|
-
}
|
|
309
|
-
set src(t) {
|
|
310
|
-
this.setAttribute("src", t);
|
|
311
|
-
}
|
|
312
|
-
get currentSrc() {
|
|
313
|
-
return e(this, i).currentSrc;
|
|
314
|
-
}
|
|
315
|
-
get currentTime() {
|
|
316
|
-
return e(this, i).currentTime;
|
|
317
|
-
}
|
|
318
|
-
set currentTime(t) {
|
|
319
|
-
e(this, i).currentTime = t;
|
|
320
|
-
}
|
|
321
|
-
get duration() {
|
|
322
|
-
return e(this, i).duration;
|
|
323
|
-
}
|
|
324
|
-
get paused() {
|
|
325
|
-
return e(this, i).paused;
|
|
326
|
-
}
|
|
327
|
-
get ended() {
|
|
328
|
-
return e(this, i).ended;
|
|
329
|
-
}
|
|
330
|
-
get readyState() {
|
|
331
|
-
return e(this, i).readyState;
|
|
332
|
-
}
|
|
333
|
-
get videoWidth() {
|
|
334
|
-
return e(this, i).videoWidth;
|
|
335
|
-
}
|
|
336
|
-
get videoHeight() {
|
|
337
|
-
return Math.floor(e(this, i).videoHeight / 2);
|
|
338
|
-
}
|
|
339
|
-
get volume() {
|
|
340
|
-
return e(this, i).volume;
|
|
341
|
-
}
|
|
342
|
-
set volume(t) {
|
|
343
|
-
e(this, i).volume = t;
|
|
344
|
-
}
|
|
345
|
-
get playbackRate() {
|
|
346
|
-
return e(this, i).playbackRate;
|
|
347
|
-
}
|
|
348
|
-
set playbackRate(t) {
|
|
349
|
-
e(this, i).playbackRate = t;
|
|
350
|
-
}
|
|
351
|
-
get defaultPlaybackRate() {
|
|
352
|
-
return e(this, i).defaultPlaybackRate;
|
|
353
|
-
}
|
|
354
|
-
set defaultPlaybackRate(t) {
|
|
355
|
-
e(this, i).defaultPlaybackRate = t;
|
|
356
|
-
}
|
|
357
|
-
get muted() {
|
|
358
|
-
return e(this, i).muted;
|
|
359
|
-
}
|
|
360
|
-
set muted(t) {
|
|
361
|
-
e(this, i).muted = t, this.toggleAttribute("muted", t);
|
|
362
|
-
}
|
|
363
|
-
get loop() {
|
|
364
|
-
return e(this, i).loop;
|
|
365
|
-
}
|
|
366
|
-
set loop(t) {
|
|
367
|
-
e(this, i).loop = t, this.toggleAttribute("loop", t);
|
|
368
|
-
}
|
|
369
|
-
get autoplay() {
|
|
370
|
-
return e(this, i).autoplay;
|
|
371
|
-
}
|
|
372
|
-
set autoplay(t) {
|
|
373
|
-
e(this, i).autoplay = t, this.toggleAttribute("autoplay", t);
|
|
374
|
-
}
|
|
375
|
-
get preload() {
|
|
376
|
-
return e(this, i).preload;
|
|
377
|
-
}
|
|
378
|
-
set preload(t) {
|
|
379
|
-
this.setAttribute("preload", t);
|
|
380
|
-
}
|
|
381
|
-
get crossOrigin() {
|
|
382
|
-
return e(this, i).crossOrigin;
|
|
383
|
-
}
|
|
384
|
-
set crossOrigin(t) {
|
|
385
|
-
t === null ? this.removeAttribute("crossorigin") : this.setAttribute("crossorigin", t);
|
|
386
|
-
}
|
|
387
|
-
get buffered() {
|
|
388
|
-
return e(this, i).buffered;
|
|
389
|
-
}
|
|
390
|
-
get seekable() {
|
|
391
|
-
return e(this, i).seekable;
|
|
392
|
-
}
|
|
393
|
-
get played() {
|
|
394
|
-
return e(this, i).played;
|
|
395
|
-
}
|
|
396
|
-
get networkState() {
|
|
397
|
-
return e(this, i).networkState;
|
|
398
|
-
}
|
|
399
|
-
get error() {
|
|
400
|
-
return e(this, i).error;
|
|
401
|
-
}
|
|
402
|
-
get seeking() {
|
|
403
|
-
return e(this, i).seeking;
|
|
404
|
-
}
|
|
405
|
-
// --- Proxied methods ---
|
|
406
|
-
play() {
|
|
407
|
-
return e(this, i).play();
|
|
408
|
-
}
|
|
409
|
-
pause() {
|
|
410
|
-
e(this, i).pause();
|
|
411
|
-
}
|
|
412
|
-
load() {
|
|
413
|
-
e(this, i).load();
|
|
414
|
-
}
|
|
415
|
-
canPlayType(t) {
|
|
416
|
-
return e(this, i).canPlayType(t);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
i = new WeakMap(), m = new WeakMap(), C = new WeakMap(), g = new WeakMap(), R = new WeakMap(), v = new WeakMap(), A = new WeakMap(), p = new WeakMap(), b = new WeakMap(), f = new WeakMap(), M = new WeakMap(), S = new WeakMap(), k = new WeakMap(), q = new WeakMap(), h = new WeakSet(), B = function() {
|
|
420
|
-
if (e(this, S)) return;
|
|
421
|
-
const t = document.createElementNS(w, "svg");
|
|
422
|
-
t.setAttribute("width", "0"), t.setAttribute("height", "0"), t.style.cssText = "position:absolute;overflow:hidden";
|
|
423
|
-
const r = document.createElementNS(w, "defs"), o = document.createElementNS(w, "filter");
|
|
424
|
-
o.id = e(this, M), o.setAttribute("filterUnits", "userSpaceOnUse"), o.setAttribute("x", "0"), o.setAttribute("y", "0"), o.setAttribute("width", "1"), o.setAttribute("height", "1"), o.setAttribute("color-interpolation-filters", "sRGB");
|
|
425
|
-
const x = document.createElementNS(w, "feOffset");
|
|
426
|
-
x.setAttribute("in", "SourceGraphic"), x.setAttribute("dy", "0"), x.setAttribute("result", "s");
|
|
427
|
-
const H = document.createElementNS(w, "feColorMatrix");
|
|
428
|
-
H.setAttribute("in", "s"), H.setAttribute("type", "matrix"), H.setAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"), H.setAttribute("result", "a");
|
|
429
|
-
const I = document.createElementNS(w, "feComposite");
|
|
430
|
-
I.setAttribute("in", "SourceGraphic"), I.setAttribute("in2", "a"), I.setAttribute("operator", "in"), o.append(x, H, I), r.appendChild(o), t.appendChild(r), document.body.appendChild(t), a(this, S, t), a(this, k, o), a(this, q, x);
|
|
431
|
-
}, K = function() {
|
|
432
|
-
var t;
|
|
433
|
-
(t = e(this, S)) == null || t.remove(), a(this, S, null), a(this, k, null), a(this, q, null);
|
|
434
|
-
}, P = function() {
|
|
435
|
-
const t = e(this, i).videoWidth, r = e(this, i).videoHeight;
|
|
436
|
-
if (!t || !r) return;
|
|
437
|
-
const o = Math.floor(r / 2);
|
|
438
|
-
e(this, m).width = t, e(this, m).height = o, e(this, g).width = t, e(this, g).height = r, d(this, h, B).call(this), e(this, k).setAttribute("width", String(t)), e(this, k).setAttribute("height", String(r)), e(this, q).setAttribute("dy", String(-o));
|
|
439
|
-
}, D = function(t, r) {
|
|
440
|
-
st.has(t) ? e(this, i)[t] = r !== null : r === null ? e(this, i).removeAttribute(t) : e(this, i).setAttribute(t, r);
|
|
441
|
-
}, z = function() {
|
|
442
|
-
e(this, i).querySelectorAll("source").forEach((t) => t.remove()), this.querySelectorAll("source").forEach((t) => {
|
|
443
|
-
e(this, i).appendChild(t.cloneNode(!0));
|
|
444
|
-
}), e(this, i).querySelectorAll("source").length > 0 && !e(this, i).src && e(this, i).load();
|
|
445
|
-
}, Q = function() {
|
|
446
|
-
if (e(this, p))
|
|
447
|
-
if (d(this, h, F).call(this), "requestVideoFrameCallback" in e(this, i)) {
|
|
448
|
-
const t = () => {
|
|
449
|
-
e(this, p) && (d(this, h, U).call(this), a(this, f, e(this, i).requestVideoFrameCallback(t)));
|
|
450
|
-
};
|
|
451
|
-
a(this, f, e(this, i).requestVideoFrameCallback(t));
|
|
452
|
-
} else {
|
|
453
|
-
const t = () => {
|
|
454
|
-
e(this, p) && (d(this, h, U).call(this), a(this, b, requestAnimationFrame(t)));
|
|
455
|
-
};
|
|
456
|
-
a(this, b, requestAnimationFrame(t));
|
|
457
|
-
}
|
|
458
|
-
}, F = function() {
|
|
459
|
-
var t, r;
|
|
460
|
-
e(this, f) && ((r = (t = e(this, i)).cancelVideoFrameCallback) == null || r.call(t, e(this, f)), a(this, f, 0)), e(this, b) && (cancelAnimationFrame(e(this, b)), a(this, b, 0));
|
|
461
|
-
}, U = function() {
|
|
462
|
-
if (e(this, i).readyState < 2) return;
|
|
463
|
-
const t = e(this, i).videoWidth, r = e(this, i).videoHeight;
|
|
464
|
-
if (!t || !r) return;
|
|
465
|
-
const o = Math.floor(r / 2);
|
|
466
|
-
(e(this, g).width !== t || e(this, g).height !== r) && d(this, h, P).call(this), e(this, R).filter = `url(#${e(this, M)})`, e(this, R).drawImage(e(this, i), 0, 0), e(this, C).clearRect(0, 0, t, o), e(this, C).drawImage(e(this, g), 0, 0, t, o, 0, 0, t, o);
|
|
467
|
-
}, V(at, "observedAttributes", [...J]);
|
|
468
|
-
export {
|
|
469
|
-
at as A,
|
|
470
|
-
it as a
|
|
471
|
-
};
|