@wapri/gplayer 0.1.1 → 0.3.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/README.md +4 -4
- package/dist/VideoPlayer/index.d.ts +2 -2
- package/dist/VideoPlayer/index.vue.d.ts +2 -2
- package/dist/constant/effect.d.ts +106 -0
- package/dist/constant/filters.d.ts +15 -0
- package/dist/constant/icons.d.ts +20 -0
- package/dist/constant/index.d.ts +5 -1
- package/dist/core/cssFilter.d.ts +4 -0
- package/dist/core/effectMenu.d.ts +32 -0
- package/dist/core/frame.d.ts +8 -0
- package/dist/core/style.d.ts +5 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.mjs +1113 -280
- package/dist/plugins/backgroundBlur.d.ts +3 -0
- package/dist/plugins/blur.d.ts +3 -0
- package/dist/plugins/chromaKey.d.ts +3 -0
- package/dist/plugins/index.d.ts +12 -1
- package/dist/plugins/intro.d.ts +3 -0
- package/dist/plugins/mosaic.d.ts +3 -0
- package/dist/plugins/overlay.d.ts +3 -0
- package/dist/plugins/reverse.d.ts +3 -0
- package/dist/plugins/stabilizer.d.ts +3 -0
- package/dist/plugins/vertical.d.ts +3 -0
- package/dist/plugins/videoFilter.d.ts +3 -0
- package/dist/plugins/webFullscreen.d.ts +3 -0
- package/dist/types/frame.d.ts +73 -0
- package/dist/types/plugin.d.ts +141 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,292 +1,1108 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { downloadBlob as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as We, ref as He, shallowRef as Ne, computed as Oe, watch as B, onMounted as Ae, onBeforeUnmount as je, openBlock as Ve, createElementBlock as Ke, normalizeStyle as De, normalizeClass as _e, unref as qe } from "vue";
|
|
2
|
+
import Z from "artplayer";
|
|
3
|
+
import { downloadBlob as Ue } from "@wapri/gbase";
|
|
4
|
+
const Xe = "网页全屏", ae = "马赛克", ie = "防抖", se = "模糊", re = "倒放", ce = "背景模糊", Ye = "开场动画", ue = "视频叠加", de = "绿幕", he = "视频滤镜", me = "横屏转竖屏", Qe = 1280, pe = 960, Ge = 2, Je = !1, Ze = 16, et = 2, tt = 64, nt = 1, ot = 0.35, lt = 0, at = 0.9, it = 0.05, st = 6, rt = 0, ct = 30, ut = 1, dt = 16, ht = 0, mt = 40, pt = 1, vt = 1.15, ft = 1, gt = "wapri", yt = 1600, wt = 0, bt = 68, xt = 68, Mt = 24, Ct = 1, kt = 6, $t = 80, Rt = "#00ff00", St = 0.35, Tt = 0.12, Pt = 0, It = 1, Ft = 0, Lt = 0.6, zt = "none", Bt = 1, Et = 0, Wt = 1, Ht = 0.05, Nt = "9:16", Ot = "crop", At = "块大小", jt = "稳像强度", Vt = "模糊程度", Kt = "背景模糊", Dt = "倒放速率", _t = "吸取背景色", qt = "点击画面取色", Ut = "相似度", Xt = "边缘羽化", Yt = "取色失败,视频源需开启跨域(CORS)", Qt = "强度", Gt = "适配方式", Jt = "裁切铺满", Zt = "完整显示", en = "旋转 90°", tn = "重播开场", nn = "透明度", on = "大小", ln = "重置位置", an = "未配置叠加素材", _ = "wa-player-intro", Pe = "wa-player-intro__text", Ie = "wa-player-intro__image", E = "wa-player-overlay", Fe = "wa-player-frame", ve = "data-wa-player-style", sn = `
|
|
5
|
+
.${Fe} {
|
|
6
|
+
position: absolute;
|
|
7
|
+
inset: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
z-index: 20;
|
|
12
|
+
}
|
|
13
|
+
.${_} {
|
|
14
|
+
position: absolute;
|
|
15
|
+
inset: 0;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
background: #000;
|
|
22
|
+
opacity: 1;
|
|
23
|
+
transition: opacity 400ms ease;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
z-index: 40;
|
|
26
|
+
}
|
|
27
|
+
.${_}--out {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
}
|
|
30
|
+
.${Ie} {
|
|
31
|
+
max-width: 40%;
|
|
32
|
+
max-height: 40%;
|
|
33
|
+
object-fit: contain;
|
|
34
|
+
animation: wa-player-intro-pop 600ms ease both;
|
|
35
|
+
}
|
|
36
|
+
.${Pe} {
|
|
37
|
+
color: #fff;
|
|
38
|
+
font-size: 20px;
|
|
39
|
+
letter-spacing: 2px;
|
|
40
|
+
animation: wa-player-intro-pop 600ms ease both;
|
|
41
|
+
}
|
|
42
|
+
.${E} {
|
|
43
|
+
position: absolute;
|
|
44
|
+
z-index: 30;
|
|
45
|
+
transform: translate(-50%, -50%);
|
|
46
|
+
touch-action: none;
|
|
47
|
+
user-select: none;
|
|
48
|
+
}
|
|
49
|
+
.${E}--draggable {
|
|
50
|
+
cursor: move;
|
|
51
|
+
}
|
|
52
|
+
.${E} img,
|
|
53
|
+
.${E} video {
|
|
54
|
+
display: block;
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: auto;
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
}
|
|
59
|
+
@keyframes wa-player-intro-pop {
|
|
60
|
+
from {
|
|
61
|
+
opacity: 0;
|
|
62
|
+
transform: scale(0.92);
|
|
63
|
+
}
|
|
64
|
+
to {
|
|
65
|
+
opacity: 1;
|
|
66
|
+
transform: scale(1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`, R = (e) => Number(e.toFixed(2)), rn = {
|
|
70
|
+
none: () => "",
|
|
71
|
+
mono: (e) => `grayscale(${R(e)})`,
|
|
72
|
+
sepia: (e) => `sepia(${R(e * 0.75)}) saturate(${R(1 + e * 0.3)}) contrast(${R(
|
|
73
|
+
1 + e * 0.05
|
|
74
|
+
)})`,
|
|
75
|
+
vivid: (e) => `saturate(${R(1 + e * 0.8)}) contrast(${R(1 + e * 0.15)})`,
|
|
76
|
+
warm: (e) => `sepia(${R(e * 0.35)}) saturate(${R(1 + e * 0.25)}) hue-rotate(${-Math.round(
|
|
77
|
+
e * 8
|
|
78
|
+
)}deg)`,
|
|
79
|
+
cool: (e) => `hue-rotate(${Math.round(e * 18)}deg) saturate(${R(1 + e * 0.15)})`,
|
|
80
|
+
fade: (e) => `contrast(${R(1 - e * 0.25)}) brightness(${R(1 + e * 0.12)}) saturate(${R(
|
|
81
|
+
1 - e * 0.4
|
|
82
|
+
)})`,
|
|
83
|
+
film: (e) => `sepia(${R(e * 0.3)}) contrast(${R(1 + e * 0.2)}) brightness(${R(
|
|
84
|
+
1 - e * 0.06
|
|
85
|
+
)}) saturate(${R(1 - e * 0.1)})`,
|
|
86
|
+
invert: (e) => `invert(${R(e)})`
|
|
87
|
+
}, X = {
|
|
88
|
+
none: "原图",
|
|
89
|
+
mono: "黑白",
|
|
90
|
+
sepia: "复古",
|
|
91
|
+
vivid: "鲜艳",
|
|
92
|
+
warm: "暖色",
|
|
93
|
+
cool: "冷色",
|
|
94
|
+
fade: "褪色",
|
|
95
|
+
film: "胶片",
|
|
96
|
+
invert: "反色"
|
|
97
|
+
}, cn = [
|
|
98
|
+
"none",
|
|
99
|
+
"mono",
|
|
100
|
+
"sepia",
|
|
101
|
+
"vivid",
|
|
102
|
+
"warm",
|
|
103
|
+
"cool",
|
|
104
|
+
"fade",
|
|
105
|
+
"film",
|
|
106
|
+
"invert"
|
|
107
|
+
], Le = (e, o) => o <= 0 ? "" : rn[e](o), un = ["filter", "webFullscreen"], ze = "@wapri/gplayer", dn = "wa-player", hn = "16 / 9", mn = {
|
|
5
108
|
lang: "zh-cn",
|
|
6
109
|
// 右侧菜单是插件的载体,默认打开
|
|
7
110
|
setting: !0,
|
|
8
111
|
fullscreen: !0,
|
|
9
112
|
miniProgressBar: !0
|
|
10
|
-
},
|
|
113
|
+
}, pn = [0.5, 0.75, 1, 1.25, 1.5, 2], fe = 1, vn = ["default", "16:9", "4:3", "21:9"], Y = "default", fn = ["normal", "horizontal", "vertical"], ge = "normal", gn = "screenshot", yn = "image/png", wn = 0.92, bn = {
|
|
11
114
|
"image/png": "png",
|
|
12
115
|
"image/jpeg": "jpg",
|
|
13
116
|
"image/webp": "webp"
|
|
14
|
-
},
|
|
15
|
-
var t,
|
|
16
|
-
return
|
|
17
|
-
...
|
|
117
|
+
}, xn = 0, Q = 100, Mn = 0, Cn = 200, kn = 1, $n = "播放速度", Rn = "画面比例", Sn = "画面翻转", Tn = "截图", Pn = "画中画", ye = "AB 循环", In = "画面调节", Fn = "设置 A 点", Ln = "设置 B 点", zn = "清除 A-B", we = "未设置", Bn = "--:--", En = "亮度", Wn = "对比度", Hn = "饱和度", Nn = "恢复默认", be = "截图失败,视频源需开启跨域(CORS)", On = (e) => Object.fromEntries(Object.entries(e).filter(([, o]) => o !== void 0)), An = (e, o, a) => {
|
|
118
|
+
var t, l, i, r, c, u, d;
|
|
119
|
+
return On({
|
|
120
|
+
...mn,
|
|
18
121
|
...e.options,
|
|
19
122
|
url: e.url,
|
|
20
123
|
poster: e.poster ?? ((t = e.options) == null ? void 0 : t.poster),
|
|
21
|
-
theme: e.theme ?? ((
|
|
124
|
+
theme: e.theme ?? ((l = e.options) == null ? void 0 : l.theme),
|
|
22
125
|
lang: e.lang ?? ((i = e.options) == null ? void 0 : i.lang),
|
|
23
|
-
autoplay: e.autoplay ?? ((
|
|
24
|
-
muted: e.muted ?? ((
|
|
25
|
-
loop: e.loop ?? ((
|
|
26
|
-
volume: e.volume ?? ((
|
|
27
|
-
container:
|
|
28
|
-
plugins:
|
|
126
|
+
autoplay: e.autoplay ?? ((r = e.options) == null ? void 0 : r.autoplay),
|
|
127
|
+
muted: e.muted ?? ((c = e.options) == null ? void 0 : c.muted),
|
|
128
|
+
loop: e.loop ?? ((u = e.options) == null ? void 0 : u.loop),
|
|
129
|
+
volume: e.volume ?? ((d = e.options) == null ? void 0 : d.volume),
|
|
130
|
+
container: o,
|
|
131
|
+
plugins: a
|
|
29
132
|
});
|
|
30
|
-
},
|
|
133
|
+
}, jn = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
31
134
|
<path d="M17 2l4 4-4 4V7H7a3 3 0 0 0-3 3v1H2v-1a5 5 0 0 1 5-5h10V2z"/>
|
|
32
135
|
<path d="M7 22l-4-4 4-4v3h10a3 3 0 0 0 3-3v-1h2v1a5 5 0 0 1-5 5H7v3z"/>
|
|
33
|
-
</svg>`,
|
|
136
|
+
</svg>`, xe = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
34
137
|
<path d="M3 5h18v2H3V5zm0 6h18v2H3v-2zm0 6h18v2H3v-2z" opacity=".35"/>
|
|
35
138
|
<circle cx="8" cy="6" r="3"/>
|
|
36
139
|
<circle cx="15" cy="12" r="3"/>
|
|
37
140
|
<circle cx="10" cy="18" r="3"/>
|
|
38
|
-
</svg>`,
|
|
141
|
+
</svg>`, Vn = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
142
|
+
<path d="M3 3h6v6H3V3zm12 0h6v6h-6V3zM3 15h6v6H3v-6zm12 0h6v6h-6v-6z"/>
|
|
143
|
+
</svg>`, Kn = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
144
|
+
<circle cx="12" cy="12" r="6"/>
|
|
145
|
+
<path d="M12 2v4M12 18v4M2 12h4M18 12h4"/>
|
|
146
|
+
</svg>`, Dn = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
147
|
+
<circle cx="12" cy="12" r="9" opacity=".22"/>
|
|
148
|
+
<circle cx="12" cy="12" r="6" opacity=".5"/>
|
|
149
|
+
<circle cx="12" cy="12" r="3"/>
|
|
150
|
+
</svg>`, Me = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
151
|
+
<path d="M11 5v14l-8-7 8-7z"/>
|
|
152
|
+
<rect x="15" y="5" width="2.4" height="14" rx="1.2"/>
|
|
153
|
+
</svg>`, _n = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
154
|
+
<rect x="2" y="2" width="20" height="20" rx="3" opacity=".28"/>
|
|
155
|
+
<rect x="7" y="6" width="10" height="12" rx="2"/>
|
|
156
|
+
</svg>`, qn = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
157
|
+
<rect x="3" y="4" width="18" height="16" rx="2" opacity=".28"/>
|
|
158
|
+
<path d="M10 8.5v7l6-3.5-6-3.5z"/>
|
|
159
|
+
<path d="M18 2l.8 1.7 1.7.8-1.7.8L18 7l-.8-1.7-1.7-.8 1.7-.8L18 2z"/>
|
|
160
|
+
</svg>`, V = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
161
|
+
<path d="M12 3l9 5-9 5-9-5 9-5z"/>
|
|
162
|
+
<path d="M4.5 12.6L12 16.8l7.5-4.2 1.5 1.4-9 5-9-5 1.5-1.4z" opacity=".55"/>
|
|
163
|
+
</svg>`, K = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
164
|
+
<path d="M17.4 3.2a2.6 2.6 0 013.4 3.4l-2.6 2.6-3.4-3.4 2.6-2.6zM13.6 6.9l3.5 3.5-8.3 8.3-3.5-3.5 8.3-8.3zM4 18.4l2.6-.9-1.7-1.7-.9 2.6z"/>
|
|
165
|
+
</svg>`, Ce = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor">
|
|
166
|
+
<circle cx="9" cy="9" r="5.2" opacity=".7"/>
|
|
167
|
+
<circle cx="15" cy="9" r="5.2" opacity=".7"/>
|
|
168
|
+
<circle cx="12" cy="14.5" r="5.2" opacity=".7"/>
|
|
169
|
+
</svg>`, ke = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
|
170
|
+
<rect x="7" y="2" width="10" height="20" rx="2.2"/>
|
|
171
|
+
<path d="M10.5 18.5h3"/>
|
|
172
|
+
<path d="M3 7v4M3 11l1.6-1.6M3 11l1.6 1.6" stroke-linecap="round"/>
|
|
173
|
+
</svg>`, $e = (e) => e === null ? Bn : Z.utils.secondToTime(e), Un = {
|
|
39
174
|
key: "abLoop",
|
|
40
|
-
label:
|
|
175
|
+
label: ye,
|
|
41
176
|
defaultConfig: {
|
|
42
|
-
offset:
|
|
177
|
+
offset: xn
|
|
43
178
|
},
|
|
44
|
-
install({ art: e, setting:
|
|
45
|
-
let t = null,
|
|
46
|
-
const i = () => t === null &&
|
|
47
|
-
|
|
48
|
-
html:
|
|
49
|
-
icon:
|
|
50
|
-
tooltip:
|
|
179
|
+
install({ art: e, setting: o, onCleanup: a }, n) {
|
|
180
|
+
let t = null, l = null;
|
|
181
|
+
const i = () => t === null && l === null ? we : `${$e(t)} - ${$e(l)}`;
|
|
182
|
+
o({
|
|
183
|
+
html: ye,
|
|
184
|
+
icon: jn,
|
|
185
|
+
tooltip: we,
|
|
51
186
|
selector: [
|
|
52
|
-
{ html:
|
|
53
|
-
{ html:
|
|
54
|
-
{ html:
|
|
187
|
+
{ html: Fn, value: "start" },
|
|
188
|
+
{ html: Ln, value: "end" },
|
|
189
|
+
{ html: zn, value: "clear" }
|
|
55
190
|
],
|
|
56
|
-
onSelect: (
|
|
57
|
-
const
|
|
58
|
-
return
|
|
191
|
+
onSelect: (c) => {
|
|
192
|
+
const u = String(c.value), d = e.currentTime;
|
|
193
|
+
return u === "start" && (t = d, l !== null && l <= t && (l = null)), u === "end" && (l = d, t !== null && l <= t && (t = null)), u === "clear" && (t = null, l = null), e.notice.show = i(), i();
|
|
59
194
|
}
|
|
60
195
|
});
|
|
61
|
-
const
|
|
62
|
-
t === null ||
|
|
196
|
+
const r = () => {
|
|
197
|
+
t === null || l === null || e.currentTime >= l - n.offset && (e.currentTime = t);
|
|
63
198
|
};
|
|
64
|
-
e.on("video:timeupdate",
|
|
199
|
+
e.on("video:timeupdate", r), a(() => e.off("video:timeupdate", r));
|
|
65
200
|
}
|
|
66
|
-
},
|
|
201
|
+
}, H = (e) => e.cloneNode(!0), Xn = {
|
|
67
202
|
key: "aspectRatio",
|
|
68
|
-
label:
|
|
203
|
+
label: Rn,
|
|
69
204
|
defaultConfig: {
|
|
70
|
-
ratios:
|
|
71
|
-
defaultRatio:
|
|
205
|
+
ratios: vn,
|
|
206
|
+
defaultRatio: Y
|
|
72
207
|
},
|
|
73
|
-
install({ art: e, setting:
|
|
74
|
-
const
|
|
75
|
-
|
|
208
|
+
install({ art: e, setting: o }, a) {
|
|
209
|
+
const n = (t) => t === Y ? e.i18n.get("Default") : t;
|
|
210
|
+
a.defaultRatio !== Y && (e.aspectRatio = a.defaultRatio), o({
|
|
76
211
|
html: e.i18n.get("Aspect Ratio"),
|
|
77
|
-
icon:
|
|
78
|
-
tooltip:
|
|
79
|
-
selector:
|
|
80
|
-
html:
|
|
212
|
+
icon: H(e.icons.aspectRatio),
|
|
213
|
+
tooltip: n(a.defaultRatio),
|
|
214
|
+
selector: a.ratios.map((t) => ({
|
|
215
|
+
html: n(t),
|
|
81
216
|
value: t,
|
|
82
|
-
default: t ===
|
|
217
|
+
default: t === a.defaultRatio
|
|
83
218
|
})),
|
|
84
219
|
onSelect: (t) => {
|
|
85
|
-
const
|
|
86
|
-
return e.aspectRatio =
|
|
220
|
+
const l = String(t.value);
|
|
221
|
+
return e.aspectRatio = l, n(l);
|
|
87
222
|
}
|
|
88
223
|
});
|
|
89
224
|
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
225
|
+
}, q = (e, o) => {
|
|
226
|
+
const a = e.setting({
|
|
227
|
+
html: o.label,
|
|
228
|
+
icon: o.icon,
|
|
229
|
+
switch: o.enabled,
|
|
230
|
+
onSwitch: (t) => {
|
|
231
|
+
const l = !t.switch;
|
|
232
|
+
return o.onToggle(l), l;
|
|
233
|
+
}
|
|
234
|
+
}), n = e.setting({
|
|
235
|
+
html: o.rangeLabel,
|
|
236
|
+
icon: o.icon,
|
|
237
|
+
range: [o.value, o.min, o.max, o.step],
|
|
238
|
+
onChange: (t) => {
|
|
239
|
+
var i;
|
|
240
|
+
const l = Number(((i = t.$range) == null ? void 0 : i.value) ?? o.value);
|
|
241
|
+
return o.onRange(l), String(l);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
return { switchItem: a, rangeItem: n };
|
|
245
|
+
}, Yn = {
|
|
246
|
+
key: "backgroundBlur",
|
|
247
|
+
label: ce,
|
|
248
|
+
defaultConfig: {
|
|
249
|
+
enabled: !1,
|
|
250
|
+
radius: dt,
|
|
251
|
+
min: ht,
|
|
252
|
+
max: mt,
|
|
253
|
+
step: pt
|
|
254
|
+
},
|
|
255
|
+
install({ frame: e, setting: o, onCleanup: a }, n) {
|
|
256
|
+
let t = n.enabled, l = n.radius, i;
|
|
257
|
+
const r = () => {
|
|
258
|
+
e.set("backgroundBlur", t && l > 0 ? { radius: l, overscan: vt } : null);
|
|
259
|
+
};
|
|
260
|
+
i = q(
|
|
261
|
+
{ setting: o },
|
|
262
|
+
{
|
|
263
|
+
label: ce,
|
|
264
|
+
icon: _n,
|
|
265
|
+
rangeLabel: Kt,
|
|
266
|
+
enabled: t,
|
|
267
|
+
value: l,
|
|
268
|
+
min: n.min,
|
|
269
|
+
max: n.max,
|
|
270
|
+
step: n.step,
|
|
271
|
+
onToggle: (c) => {
|
|
272
|
+
t = c, r();
|
|
273
|
+
},
|
|
274
|
+
onRange: (c) => {
|
|
275
|
+
l = c, t || (t = !0, i && (i.switchItem.switch = !0)), r();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
), r(), a(() => e.set("backgroundBlur", null));
|
|
279
|
+
}
|
|
280
|
+
}, Qn = {
|
|
281
|
+
key: "blur",
|
|
282
|
+
label: se,
|
|
283
|
+
defaultConfig: {
|
|
284
|
+
enabled: !1,
|
|
285
|
+
radius: st,
|
|
286
|
+
min: rt,
|
|
287
|
+
max: ct,
|
|
288
|
+
step: ut
|
|
289
|
+
},
|
|
290
|
+
install({ frame: e, setting: o, onCleanup: a }, n) {
|
|
291
|
+
let t = n.enabled, l = n.radius, i;
|
|
292
|
+
const r = () => {
|
|
293
|
+
e.set("blur", t && l > 0 ? { radius: l } : null);
|
|
294
|
+
};
|
|
295
|
+
i = q(
|
|
296
|
+
{ setting: o },
|
|
297
|
+
{
|
|
298
|
+
label: se,
|
|
299
|
+
icon: Dn,
|
|
300
|
+
rangeLabel: Vt,
|
|
301
|
+
enabled: t,
|
|
302
|
+
value: l,
|
|
303
|
+
min: n.min,
|
|
304
|
+
max: n.max,
|
|
305
|
+
step: n.step,
|
|
306
|
+
onToggle: (c) => {
|
|
307
|
+
t = c, r();
|
|
308
|
+
},
|
|
309
|
+
onRange: (c) => {
|
|
310
|
+
l = c, t || (t = !0, i && (i.switchItem.switch = !0)), r();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
), r(), a(() => e.set("blur", null));
|
|
314
|
+
}
|
|
315
|
+
}, Gn = {
|
|
316
|
+
key: "chromaKey",
|
|
96
317
|
label: de,
|
|
97
318
|
defaultConfig: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
319
|
+
enabled: !1,
|
|
320
|
+
color: Rt,
|
|
321
|
+
similarity: St,
|
|
322
|
+
smoothness: Tt,
|
|
323
|
+
similarityMin: Pt,
|
|
324
|
+
similarityMax: It,
|
|
325
|
+
smoothnessMin: Ft,
|
|
326
|
+
smoothnessMax: Lt
|
|
104
327
|
},
|
|
105
|
-
install({ art: e, setting:
|
|
328
|
+
install({ art: e, frame: o, setting: a, onCleanup: n }, t) {
|
|
329
|
+
let l = t.enabled, i = t.color, r = t.similarity, c = t.smoothness, u, d, x;
|
|
330
|
+
const b = () => {
|
|
331
|
+
o.set("chromaKey", l ? { color: i, similarity: r, smoothness: c } : null);
|
|
332
|
+
}, v = () => {
|
|
333
|
+
l || (l = !0, u && (u.switch = !0));
|
|
334
|
+
}, s = () => {
|
|
335
|
+
x && (e.template.$player.removeEventListener("click", x, !0), x = void 0);
|
|
336
|
+
}, f = () => {
|
|
337
|
+
s(), e.notice.show = qt, x = (y) => {
|
|
338
|
+
y.stopPropagation(), s();
|
|
339
|
+
const C = o.pickColor(y.clientX, y.clientY);
|
|
340
|
+
if (!C) {
|
|
341
|
+
e.notice.show = Yt;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
i = C, d && (d.tooltip = C), v(), b();
|
|
345
|
+
}, e.template.$player.addEventListener("click", x, !0);
|
|
346
|
+
};
|
|
347
|
+
u = a({
|
|
348
|
+
html: de,
|
|
349
|
+
icon: K,
|
|
350
|
+
switch: l,
|
|
351
|
+
onSwitch: (y) => (l = !y.switch, b(), l)
|
|
352
|
+
}), d = a({
|
|
353
|
+
html: _t,
|
|
354
|
+
icon: K,
|
|
355
|
+
tooltip: i,
|
|
356
|
+
onClick: () => (f(), i)
|
|
357
|
+
}), a({
|
|
358
|
+
html: Ut,
|
|
359
|
+
icon: K,
|
|
360
|
+
range: [r, t.similarityMin, t.similarityMax, 0.01],
|
|
361
|
+
onChange: (y) => {
|
|
362
|
+
var C;
|
|
363
|
+
return r = Number(((C = y.$range) == null ? void 0 : C.value) ?? r), v(), b(), `${Math.round(r * 100)}%`;
|
|
364
|
+
}
|
|
365
|
+
}), a({
|
|
366
|
+
html: Xt,
|
|
367
|
+
icon: K,
|
|
368
|
+
range: [c, t.smoothnessMin, t.smoothnessMax, 0.01],
|
|
369
|
+
onChange: (y) => {
|
|
370
|
+
var C;
|
|
371
|
+
return c = Number(((C = y.$range) == null ? void 0 : C.value) ?? c), v(), b(), `${Math.round(c * 100)}%`;
|
|
372
|
+
}
|
|
373
|
+
}), b(), n(() => {
|
|
374
|
+
s(), o.set("chromaKey", null);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}, G = ["brightness", "contrast", "saturate"], Jn = {
|
|
378
|
+
brightness: En,
|
|
379
|
+
contrast: Wn,
|
|
380
|
+
saturate: Hn
|
|
381
|
+
}, Zn = {
|
|
382
|
+
key: "filter",
|
|
383
|
+
label: In,
|
|
384
|
+
defaultConfig: {
|
|
385
|
+
brightness: Q,
|
|
386
|
+
contrast: Q,
|
|
387
|
+
saturate: Q,
|
|
388
|
+
min: Mn,
|
|
389
|
+
max: Cn,
|
|
390
|
+
step: kn
|
|
391
|
+
},
|
|
392
|
+
install({ setting: e, onCleanup: o, cssFilter: a }, n) {
|
|
106
393
|
const t = {
|
|
107
|
-
brightness:
|
|
108
|
-
contrast:
|
|
109
|
-
saturate:
|
|
110
|
-
},
|
|
111
|
-
|
|
394
|
+
brightness: n.brightness,
|
|
395
|
+
contrast: n.contrast,
|
|
396
|
+
saturate: n.saturate
|
|
397
|
+
}, l = [], i = () => {
|
|
398
|
+
a.set("adjust", G.map((r) => `${r}(${t[r]}%)`).join(" "));
|
|
112
399
|
};
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
html:
|
|
116
|
-
icon:
|
|
117
|
-
range: [t[
|
|
400
|
+
G.forEach((r) => {
|
|
401
|
+
const c = e({
|
|
402
|
+
html: Jn[r],
|
|
403
|
+
icon: xe,
|
|
404
|
+
range: [t[r], n.min, n.max, n.step],
|
|
118
405
|
// 返回值会写回菜单项右侧的副标题
|
|
119
|
-
onChange: (
|
|
120
|
-
var
|
|
121
|
-
return t[
|
|
406
|
+
onChange: (u) => {
|
|
407
|
+
var d;
|
|
408
|
+
return t[r] = Number(((d = u.$range) == null ? void 0 : d.value) ?? t[r]), i(), `${t[r]}%`;
|
|
122
409
|
}
|
|
123
410
|
});
|
|
124
|
-
|
|
125
|
-
}),
|
|
126
|
-
html:
|
|
127
|
-
icon:
|
|
128
|
-
tooltip: `${
|
|
129
|
-
onClick: () => (
|
|
130
|
-
t[
|
|
131
|
-
}),
|
|
132
|
-
|
|
133
|
-
}), i(), `${
|
|
411
|
+
l.push({ key: r, item: c });
|
|
412
|
+
}), e({
|
|
413
|
+
html: Nn,
|
|
414
|
+
icon: xe,
|
|
415
|
+
tooltip: `${n.brightness}%`,
|
|
416
|
+
onClick: () => (G.forEach((r) => {
|
|
417
|
+
t[r] = n[r];
|
|
418
|
+
}), l.forEach(({ key: r, item: c }) => {
|
|
419
|
+
c.$range && (c.$range.value = String(t[r]));
|
|
420
|
+
}), i(), `${n.brightness}%`)
|
|
134
421
|
}), i(), o(() => {
|
|
135
|
-
|
|
422
|
+
a.remove("adjust");
|
|
136
423
|
});
|
|
137
424
|
}
|
|
138
|
-
},
|
|
425
|
+
}, eo = {
|
|
139
426
|
normal: "Normal",
|
|
140
427
|
horizontal: "Horizontal",
|
|
141
428
|
vertical: "Vertical"
|
|
142
|
-
},
|
|
429
|
+
}, to = {
|
|
143
430
|
key: "flip",
|
|
144
|
-
label:
|
|
431
|
+
label: Sn,
|
|
145
432
|
defaultConfig: {
|
|
146
|
-
modes:
|
|
147
|
-
defaultMode:
|
|
433
|
+
modes: fn,
|
|
434
|
+
defaultMode: ge
|
|
148
435
|
},
|
|
149
|
-
install({ art: e, setting:
|
|
150
|
-
const
|
|
151
|
-
|
|
436
|
+
install({ art: e, setting: o }, a) {
|
|
437
|
+
const n = (t) => e.i18n.get(eo[t]);
|
|
438
|
+
a.defaultMode !== ge && (e.flip = a.defaultMode), o({
|
|
152
439
|
html: e.i18n.get("Video Flip"),
|
|
153
|
-
icon:
|
|
154
|
-
tooltip:
|
|
155
|
-
selector:
|
|
156
|
-
html:
|
|
440
|
+
icon: H(e.icons.flip),
|
|
441
|
+
tooltip: n(a.defaultMode),
|
|
442
|
+
selector: a.modes.map((t) => ({
|
|
443
|
+
html: n(t),
|
|
157
444
|
value: t,
|
|
158
|
-
default: t ===
|
|
445
|
+
default: t === a.defaultMode
|
|
159
446
|
})),
|
|
160
447
|
onSelect: (t) => {
|
|
161
|
-
const
|
|
162
|
-
return e.flip =
|
|
448
|
+
const l = String(t.value);
|
|
449
|
+
return e.flip = l, n(l);
|
|
163
450
|
}
|
|
164
451
|
});
|
|
165
452
|
}
|
|
166
|
-
},
|
|
453
|
+
}, ee = () => {
|
|
454
|
+
if (typeof document > "u" || document.head.querySelector(`style[${ve}]`)) return;
|
|
455
|
+
const e = document.createElement("style");
|
|
456
|
+
e.setAttribute(ve, ""), e.textContent = sn, document.head.appendChild(e);
|
|
457
|
+
}, no = {
|
|
458
|
+
key: "intro",
|
|
459
|
+
label: Ye,
|
|
460
|
+
defaultConfig: {
|
|
461
|
+
image: "",
|
|
462
|
+
text: gt,
|
|
463
|
+
duration: yt,
|
|
464
|
+
delay: wt,
|
|
465
|
+
once: !0
|
|
466
|
+
},
|
|
467
|
+
install({ art: e, setting: o, onCleanup: a }, n) {
|
|
468
|
+
ee();
|
|
469
|
+
let t, l = 0;
|
|
470
|
+
const i = () => {
|
|
471
|
+
l && (window.clearTimeout(l), l = 0), t == null || t.remove(), t = void 0;
|
|
472
|
+
}, r = () => {
|
|
473
|
+
if (i(), !n.image && !n.text) return;
|
|
474
|
+
const u = document.createElement("div");
|
|
475
|
+
if (u.className = _, n.image) {
|
|
476
|
+
const d = document.createElement("img");
|
|
477
|
+
d.className = Ie, d.src = n.image, d.alt = "", u.appendChild(d);
|
|
478
|
+
}
|
|
479
|
+
if (n.text) {
|
|
480
|
+
const d = document.createElement("div");
|
|
481
|
+
d.className = Pe, d.textContent = n.text, u.appendChild(d);
|
|
482
|
+
}
|
|
483
|
+
e.template.$player.appendChild(u), t = u, l = window.setTimeout(
|
|
484
|
+
() => {
|
|
485
|
+
u.classList.add(`${_}--out`), l = window.setTimeout(i, 400);
|
|
486
|
+
},
|
|
487
|
+
Math.max(0, n.duration)
|
|
488
|
+
);
|
|
489
|
+
}, c = () => {
|
|
490
|
+
if (n.delay > 0) {
|
|
491
|
+
l = window.setTimeout(r, n.delay);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
r();
|
|
495
|
+
};
|
|
496
|
+
n.once ? e.once("play", c) : e.on("play", c), o({
|
|
497
|
+
html: tn,
|
|
498
|
+
icon: qn,
|
|
499
|
+
onClick: () => (r(), "")
|
|
500
|
+
}), a(() => {
|
|
501
|
+
i(), e.off("play", c);
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
}, oo = {
|
|
505
|
+
key: "mosaic",
|
|
506
|
+
label: ae,
|
|
507
|
+
defaultConfig: {
|
|
508
|
+
enabled: !1,
|
|
509
|
+
size: Ze,
|
|
510
|
+
min: et,
|
|
511
|
+
max: tt,
|
|
512
|
+
step: nt
|
|
513
|
+
},
|
|
514
|
+
install({ frame: e, setting: o, onCleanup: a }, n) {
|
|
515
|
+
let t = n.enabled, l = n.size, i;
|
|
516
|
+
const r = () => {
|
|
517
|
+
e.set("mosaic", t ? { size: l } : null);
|
|
518
|
+
};
|
|
519
|
+
i = q(
|
|
520
|
+
{ setting: o },
|
|
521
|
+
{
|
|
522
|
+
label: ae,
|
|
523
|
+
icon: Vn,
|
|
524
|
+
rangeLabel: At,
|
|
525
|
+
enabled: t,
|
|
526
|
+
value: l,
|
|
527
|
+
min: n.min,
|
|
528
|
+
max: n.max,
|
|
529
|
+
step: n.step,
|
|
530
|
+
onToggle: (c) => {
|
|
531
|
+
t = c, r();
|
|
532
|
+
},
|
|
533
|
+
onRange: (c) => {
|
|
534
|
+
l = c, t || (t = !0, i && (i.switchItem.switch = !0)), r();
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
), r(), a(() => e.set("mosaic", null));
|
|
538
|
+
}
|
|
539
|
+
}, Re = (e) => Math.min(100, Math.max(0, e)), lo = {
|
|
540
|
+
key: "overlay",
|
|
541
|
+
label: ue,
|
|
542
|
+
defaultConfig: {
|
|
543
|
+
src: "",
|
|
544
|
+
type: "image",
|
|
545
|
+
x: bt,
|
|
546
|
+
y: xt,
|
|
547
|
+
width: Mt,
|
|
548
|
+
opacity: Ct,
|
|
549
|
+
draggable: !0,
|
|
550
|
+
loop: !0
|
|
551
|
+
},
|
|
552
|
+
install({ art: e, setting: o, onCleanup: a }, n) {
|
|
553
|
+
ee();
|
|
554
|
+
let t, l, i = { x: n.x, y: n.y }, r = n.width, c = n.opacity;
|
|
555
|
+
const u = () => {
|
|
556
|
+
t && (t.style.left = `${i.x}%`, t.style.top = `${i.y}%`, t.style.width = `${r}%`, t.style.opacity = String(c));
|
|
557
|
+
}, d = (v) => {
|
|
558
|
+
let s, f;
|
|
559
|
+
const y = () => {
|
|
560
|
+
s && window.removeEventListener("pointermove", s), f && window.removeEventListener("pointerup", f), s = void 0, f = void 0;
|
|
561
|
+
}, C = (F) => {
|
|
562
|
+
F.preventDefault(), F.stopPropagation();
|
|
563
|
+
const L = e.template.$player.getBoundingClientRect();
|
|
564
|
+
s = (j) => {
|
|
565
|
+
i = {
|
|
566
|
+
x: Re((j.clientX - L.left) / L.width * 100),
|
|
567
|
+
y: Re((j.clientY - L.top) / L.height * 100)
|
|
568
|
+
}, u();
|
|
569
|
+
}, f = y, window.addEventListener("pointermove", s), window.addEventListener("pointerup", f);
|
|
570
|
+
};
|
|
571
|
+
v.addEventListener("pointerdown", C), a(() => {
|
|
572
|
+
v.removeEventListener("pointerdown", C), y();
|
|
573
|
+
});
|
|
574
|
+
}, x = () => {
|
|
575
|
+
if (t) return;
|
|
576
|
+
if (!n.src) {
|
|
577
|
+
e.notice.show = an;
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
const v = document.createElement("div");
|
|
581
|
+
if (v.className = n.draggable ? `${E} ${E}--draggable` : E, n.type === "video") {
|
|
582
|
+
const s = document.createElement("video");
|
|
583
|
+
s.src = n.src, s.muted = !0, s.loop = n.loop, s.autoplay = !0, s.playsInline = !0, s.play().catch(() => {
|
|
584
|
+
}), v.appendChild(s);
|
|
585
|
+
} else {
|
|
586
|
+
const s = document.createElement("img");
|
|
587
|
+
s.src = n.src, s.alt = "", v.appendChild(s);
|
|
588
|
+
}
|
|
589
|
+
e.template.$player.appendChild(v), t = v, u(), n.draggable && d(v);
|
|
590
|
+
}, b = () => {
|
|
591
|
+
t == null || t.remove(), t = void 0;
|
|
592
|
+
};
|
|
593
|
+
l = o({
|
|
594
|
+
html: ue,
|
|
595
|
+
icon: V,
|
|
596
|
+
switch: !!n.src,
|
|
597
|
+
onSwitch: (v) => {
|
|
598
|
+
const s = !v.switch;
|
|
599
|
+
return s ? x() : b(), s;
|
|
600
|
+
}
|
|
601
|
+
}), o({
|
|
602
|
+
html: nn,
|
|
603
|
+
icon: V,
|
|
604
|
+
range: [c, 0, 1, 0.05],
|
|
605
|
+
onChange: (v) => {
|
|
606
|
+
var s;
|
|
607
|
+
return c = Number(((s = v.$range) == null ? void 0 : s.value) ?? c), u(), `${Math.round(c * 100)}%`;
|
|
608
|
+
}
|
|
609
|
+
}), o({
|
|
610
|
+
html: on,
|
|
611
|
+
icon: V,
|
|
612
|
+
range: [r, kt, $t, 1],
|
|
613
|
+
onChange: (v) => {
|
|
614
|
+
var s;
|
|
615
|
+
return r = Number(((s = v.$range) == null ? void 0 : s.value) ?? r), u(), `${r}%`;
|
|
616
|
+
}
|
|
617
|
+
}), o({
|
|
618
|
+
html: ln,
|
|
619
|
+
icon: V,
|
|
620
|
+
onClick: () => (i = { x: n.x, y: n.y }, u(), "")
|
|
621
|
+
}), l.switch && x(), a(b);
|
|
622
|
+
}
|
|
623
|
+
}, Se = () => "pictureInPictureEnabled" in document && document.pictureInPictureEnabled, ao = {
|
|
167
624
|
key: "pip",
|
|
168
|
-
label:
|
|
625
|
+
label: Pn,
|
|
169
626
|
defaultConfig: {
|
|
170
627
|
autoEnter: !1
|
|
171
628
|
},
|
|
172
|
-
install({ art: e, setting:
|
|
173
|
-
const t =
|
|
629
|
+
install({ art: e, setting: o, onCleanup: a }, n) {
|
|
630
|
+
const t = o({
|
|
174
631
|
html: e.i18n.get("PIP Mode"),
|
|
175
|
-
icon:
|
|
632
|
+
icon: H(e.icons.pip),
|
|
176
633
|
switch: e.pip,
|
|
177
634
|
onSwitch: () => {
|
|
178
|
-
const
|
|
179
|
-
return
|
|
635
|
+
const l = !e.pip;
|
|
636
|
+
return Se() ? (e.pip = l, l) : (e.notice.show = e.i18n.get("PIP Not Supported"), e.pip);
|
|
180
637
|
}
|
|
181
638
|
});
|
|
182
|
-
if (e.on("pip", (
|
|
183
|
-
t.switch =
|
|
184
|
-
}),
|
|
185
|
-
const
|
|
186
|
-
document.visibilityState === "hidden" && e.playing &&
|
|
639
|
+
if (e.on("pip", (l) => {
|
|
640
|
+
t.switch = l;
|
|
641
|
+
}), n.autoEnter) {
|
|
642
|
+
const l = () => {
|
|
643
|
+
document.visibilityState === "hidden" && e.playing && Se() && (e.pip = !0);
|
|
187
644
|
};
|
|
188
|
-
document.addEventListener("visibilitychange",
|
|
645
|
+
document.addEventListener("visibilitychange", l), a(() => document.removeEventListener("visibilitychange", l));
|
|
189
646
|
}
|
|
190
647
|
}
|
|
191
|
-
},
|
|
648
|
+
}, J = (e) => `${e}x`, io = {
|
|
192
649
|
key: "playbackRate",
|
|
193
|
-
label:
|
|
650
|
+
label: $n,
|
|
194
651
|
defaultConfig: {
|
|
195
|
-
rates:
|
|
196
|
-
defaultRate:
|
|
652
|
+
rates: pn,
|
|
653
|
+
defaultRate: fe
|
|
197
654
|
},
|
|
198
|
-
install({ art: e, setting:
|
|
199
|
-
|
|
655
|
+
install({ art: e, setting: o }, a) {
|
|
656
|
+
a.defaultRate !== fe && (e.playbackRate = a.defaultRate), o({
|
|
200
657
|
html: e.i18n.get("Play Speed"),
|
|
201
|
-
icon:
|
|
202
|
-
tooltip:
|
|
203
|
-
selector:
|
|
204
|
-
html:
|
|
205
|
-
value:
|
|
206
|
-
default:
|
|
658
|
+
icon: H(e.icons.playbackRate),
|
|
659
|
+
tooltip: J(a.defaultRate),
|
|
660
|
+
selector: a.rates.map((n) => ({
|
|
661
|
+
html: J(n),
|
|
662
|
+
value: n,
|
|
663
|
+
default: n === a.defaultRate
|
|
207
664
|
})),
|
|
208
665
|
// 返回值会写回菜单项右侧的副标题
|
|
209
|
-
onSelect: (
|
|
210
|
-
const t = Number(
|
|
211
|
-
return Number.isNaN(t) ? "" : (e.playbackRate = t,
|
|
666
|
+
onSelect: (n) => {
|
|
667
|
+
const t = Number(n.value);
|
|
668
|
+
return Number.isNaN(t) ? "" : (e.playbackRate = t, J(t));
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
}, so = [0.5, 1, 1.5, 2], ro = {
|
|
673
|
+
key: "reverse",
|
|
674
|
+
label: re,
|
|
675
|
+
defaultConfig: {
|
|
676
|
+
enabled: !1,
|
|
677
|
+
rate: ft
|
|
678
|
+
},
|
|
679
|
+
install({ art: e, setting: o, onCleanup: a }, n) {
|
|
680
|
+
let t = n.enabled, l = n.rate, i = 0, r = 0, c;
|
|
681
|
+
const u = () => {
|
|
682
|
+
i && cancelAnimationFrame(i), i = 0;
|
|
683
|
+
}, d = (v) => {
|
|
684
|
+
const s = e.video, f = Math.max(0, (v - r) / 1e3);
|
|
685
|
+
r = v;
|
|
686
|
+
const y = s.currentTime - f * l;
|
|
687
|
+
if (y > 0) {
|
|
688
|
+
s.currentTime = y, i = requestAnimationFrame(d);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if (s.loop && e.duration > 0) {
|
|
692
|
+
s.currentTime = e.duration, i = requestAnimationFrame(d);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
s.currentTime = 0, u(), t = !1, c && (c.switch = !1);
|
|
696
|
+
}, x = () => {
|
|
697
|
+
e.pause(), u(), r = performance.now(), i = requestAnimationFrame(d);
|
|
698
|
+
}, b = () => {
|
|
699
|
+
t && (t = !1, u(), c && (c.switch = !1));
|
|
700
|
+
};
|
|
701
|
+
c = o({
|
|
702
|
+
html: re,
|
|
703
|
+
icon: Me,
|
|
704
|
+
switch: t,
|
|
705
|
+
onSwitch: (v) => {
|
|
706
|
+
const s = !v.switch;
|
|
707
|
+
return t = s, s ? x() : u(), s;
|
|
212
708
|
}
|
|
709
|
+
}), o({
|
|
710
|
+
html: Dt,
|
|
711
|
+
icon: Me,
|
|
712
|
+
tooltip: `${l}x`,
|
|
713
|
+
selector: so.map((v) => ({
|
|
714
|
+
html: `${v}x`,
|
|
715
|
+
value: v,
|
|
716
|
+
default: v === l
|
|
717
|
+
})),
|
|
718
|
+
onSelect: (v) => (l = Number(v.value), `${l}x`)
|
|
719
|
+
}), e.on("play", b), t && x(), a(() => {
|
|
720
|
+
u(), e.off("play", b);
|
|
213
721
|
});
|
|
214
722
|
}
|
|
215
|
-
},
|
|
723
|
+
}, co = (e) => Z.utils.secondToTime(e).replace(/:/g, "-"), uo = (e, o) => {
|
|
216
724
|
if (!e.videoWidth || !e.videoHeight) return null;
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
if (!
|
|
725
|
+
const a = document.createElement("canvas");
|
|
726
|
+
a.width = e.videoWidth, a.height = e.videoHeight;
|
|
727
|
+
const n = a.getContext("2d");
|
|
728
|
+
if (!n) return null;
|
|
221
729
|
const t = e.style.filter;
|
|
222
|
-
return t && (
|
|
223
|
-
},
|
|
730
|
+
return t && (n.filter = t), n.drawImage(e, 0, 0, a.width, a.height), { dataUrl: a.toDataURL(o.type, o.quality), time: e.currentTime };
|
|
731
|
+
}, ho = {
|
|
224
732
|
key: "screenshot",
|
|
225
|
-
label:
|
|
733
|
+
label: Tn,
|
|
226
734
|
defaultConfig: {
|
|
227
|
-
filename:
|
|
228
|
-
type:
|
|
229
|
-
quality:
|
|
735
|
+
filename: gn,
|
|
736
|
+
type: yn,
|
|
737
|
+
quality: wn,
|
|
230
738
|
download: !0
|
|
231
739
|
},
|
|
232
|
-
install({ art: e, setting:
|
|
233
|
-
const
|
|
234
|
-
|
|
740
|
+
install({ art: e, setting: o }, a) {
|
|
741
|
+
const n = () => a.type.replace("image/", "").toUpperCase();
|
|
742
|
+
o({
|
|
235
743
|
html: e.i18n.get("Screenshot"),
|
|
236
|
-
icon:
|
|
237
|
-
tooltip:
|
|
744
|
+
icon: H(e.icons.screenshot),
|
|
745
|
+
tooltip: n(),
|
|
238
746
|
onClick: async () => {
|
|
239
747
|
var t;
|
|
240
748
|
try {
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
243
|
-
if (
|
|
244
|
-
const i = await (await fetch(
|
|
245
|
-
|
|
749
|
+
const l = uo(e.video, a);
|
|
750
|
+
if (!l) return n();
|
|
751
|
+
if (a.download) {
|
|
752
|
+
const i = await (await fetch(l.dataUrl)).blob();
|
|
753
|
+
Ue(`${a.filename}_${co(l.time)}.${bn[a.type]}`, i);
|
|
246
754
|
}
|
|
247
|
-
(t =
|
|
248
|
-
} catch (
|
|
249
|
-
console.warn(`[${
|
|
755
|
+
(t = a.onCapture) == null || t.call(a, l), e.emit("screenshot", l.dataUrl);
|
|
756
|
+
} catch (l) {
|
|
757
|
+
console.warn(`[${ze}] ${be}`, l), e.notice.show = be;
|
|
250
758
|
}
|
|
251
|
-
return
|
|
759
|
+
return n();
|
|
252
760
|
}
|
|
253
761
|
});
|
|
254
762
|
}
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
763
|
+
}, mo = {
|
|
764
|
+
key: "stabilizer",
|
|
765
|
+
label: ie,
|
|
766
|
+
defaultConfig: {
|
|
767
|
+
enabled: !1,
|
|
768
|
+
strength: ot,
|
|
769
|
+
min: lt,
|
|
770
|
+
max: at,
|
|
771
|
+
step: it
|
|
772
|
+
},
|
|
773
|
+
install({ frame: e, setting: o, onCleanup: a }, n) {
|
|
774
|
+
let t = n.enabled, l = n.strength, i;
|
|
775
|
+
const r = () => {
|
|
776
|
+
e.set("stabilizer", t && l > 0 ? { strength: l } : null);
|
|
777
|
+
};
|
|
778
|
+
i = q(
|
|
779
|
+
{ setting: o },
|
|
780
|
+
{
|
|
781
|
+
label: ie,
|
|
782
|
+
icon: Kn,
|
|
783
|
+
rangeLabel: jt,
|
|
784
|
+
enabled: t,
|
|
785
|
+
value: l,
|
|
786
|
+
min: n.min,
|
|
787
|
+
max: n.max,
|
|
788
|
+
step: n.step,
|
|
789
|
+
onToggle: (c) => {
|
|
790
|
+
t = c, r();
|
|
791
|
+
},
|
|
792
|
+
onRange: (c) => {
|
|
793
|
+
l = c, t || (t = !0, i && (i.switchItem.switch = !0)), r();
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
), r(), a(() => e.set("stabilizer", null));
|
|
797
|
+
}
|
|
798
|
+
}, D = {
|
|
799
|
+
crop: Jt,
|
|
800
|
+
contain: Zt,
|
|
801
|
+
rotate: en
|
|
802
|
+
}, po = {
|
|
803
|
+
key: "vertical",
|
|
804
|
+
label: me,
|
|
805
|
+
defaultConfig: {
|
|
806
|
+
enabled: !1,
|
|
807
|
+
mode: Ot,
|
|
808
|
+
ratio: Nt
|
|
809
|
+
},
|
|
810
|
+
install({ art: e, setting: o, frame: a, onCleanup: n }, t) {
|
|
811
|
+
let l = t.enabled, i = t.mode, r = e.aspectRatio;
|
|
812
|
+
const c = () => {
|
|
813
|
+
if (!l) {
|
|
814
|
+
e.aspectRatio = r, a.set("vertical", null);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
e.aspectRatio = t.ratio, a.set(
|
|
818
|
+
"vertical",
|
|
819
|
+
i === "rotate" ? { fit: "cover", rotate: 90 } : { fit: i === "contain" ? "contain" : "cover", rotate: 0 }
|
|
820
|
+
);
|
|
821
|
+
};
|
|
822
|
+
o({
|
|
823
|
+
html: me,
|
|
824
|
+
icon: ke,
|
|
825
|
+
switch: l,
|
|
826
|
+
onSwitch: (u) => {
|
|
827
|
+
const d = !u.switch;
|
|
828
|
+
return d && !l && (r = e.aspectRatio), l = d, c(), d;
|
|
829
|
+
}
|
|
830
|
+
}), o({
|
|
831
|
+
html: Gt,
|
|
832
|
+
icon: ke,
|
|
833
|
+
tooltip: D[i],
|
|
834
|
+
selector: Object.keys(D).map((u) => ({
|
|
835
|
+
html: D[u],
|
|
836
|
+
value: u,
|
|
837
|
+
default: u === i
|
|
838
|
+
})),
|
|
839
|
+
onSelect: (u) => (i = String(u.value), c(), D[i])
|
|
840
|
+
}), c(), n(() => {
|
|
841
|
+
a.set("vertical", null), e.aspectRatio = r;
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
}, vo = {
|
|
845
|
+
key: "videoFilter",
|
|
846
|
+
label: he,
|
|
847
|
+
defaultConfig: {
|
|
848
|
+
preset: zt,
|
|
849
|
+
intensity: Bt,
|
|
850
|
+
presets: cn,
|
|
851
|
+
min: Et,
|
|
852
|
+
max: Wt,
|
|
853
|
+
step: Ht
|
|
854
|
+
},
|
|
855
|
+
install({ setting: e, onCleanup: o, cssFilter: a }, n) {
|
|
856
|
+
let t = n.preset, l = n.intensity;
|
|
857
|
+
const i = (c) => `${Math.round(c * 100)}%`, r = () => {
|
|
858
|
+
const c = t === "none" || l <= 0 ? "" : Le(t, l);
|
|
859
|
+
a.set("preset", c);
|
|
860
|
+
};
|
|
861
|
+
e({
|
|
862
|
+
html: he,
|
|
863
|
+
icon: Ce,
|
|
864
|
+
tooltip: X[t],
|
|
865
|
+
selector: n.presets.map((c) => ({
|
|
866
|
+
html: X[c],
|
|
867
|
+
value: c,
|
|
868
|
+
default: c === t
|
|
869
|
+
})),
|
|
870
|
+
onSelect: (c) => (t = String(c.value), r(), X[t])
|
|
871
|
+
}), e({
|
|
872
|
+
html: Qt,
|
|
873
|
+
icon: Ce,
|
|
874
|
+
range: [l, n.min, n.max, n.step],
|
|
875
|
+
onChange: (c) => {
|
|
876
|
+
var u;
|
|
877
|
+
return l = Number(((u = c.$range) == null ? void 0 : u.value) ?? l), r(), i(l);
|
|
878
|
+
}
|
|
879
|
+
}), r(), o(() => a.remove("preset"));
|
|
880
|
+
}
|
|
881
|
+
}, fo = {
|
|
882
|
+
key: "webFullscreen",
|
|
883
|
+
label: Xe,
|
|
884
|
+
defaultConfig: {
|
|
885
|
+
defaultOn: Je
|
|
886
|
+
},
|
|
887
|
+
install({ art: e, setting: o }, a) {
|
|
888
|
+
const n = o({
|
|
889
|
+
html: e.i18n.get("Web Fullscreen"),
|
|
890
|
+
icon: H(e.icons.fullscreenWebOff),
|
|
891
|
+
switch: a.defaultOn,
|
|
892
|
+
onSwitch: () => (e.fullscreenWeb = !e.fullscreenWeb, e.fullscreenWeb)
|
|
893
|
+
});
|
|
894
|
+
e.on("fullscreenWeb", (t) => {
|
|
895
|
+
n.switch = t;
|
|
896
|
+
}), a.defaultOn && !e.fullscreenWeb && (e.fullscreenWeb = !0);
|
|
897
|
+
}
|
|
898
|
+
}, go = [
|
|
899
|
+
io,
|
|
900
|
+
Xn,
|
|
901
|
+
to,
|
|
902
|
+
fo,
|
|
903
|
+
ho,
|
|
904
|
+
ao,
|
|
905
|
+
Un,
|
|
906
|
+
Zn,
|
|
907
|
+
vo,
|
|
908
|
+
oo,
|
|
909
|
+
Qn,
|
|
910
|
+
Yn,
|
|
911
|
+
mo,
|
|
912
|
+
Gn,
|
|
913
|
+
po,
|
|
914
|
+
ro,
|
|
915
|
+
no,
|
|
916
|
+
lo
|
|
917
|
+
], yo = (e) => {
|
|
918
|
+
const o = /* @__PURE__ */ new Map(), a = () => [...o.values()].map((t) => t.trim()).filter(Boolean).join(" "), n = () => {
|
|
919
|
+
e.video.style.filter = a();
|
|
920
|
+
};
|
|
921
|
+
return {
|
|
922
|
+
set: (t, l) => {
|
|
923
|
+
o.set(t, l), n();
|
|
924
|
+
},
|
|
925
|
+
remove: (t) => {
|
|
926
|
+
o.delete(t), n();
|
|
927
|
+
},
|
|
928
|
+
clear: () => {
|
|
929
|
+
o.clear(), n();
|
|
930
|
+
},
|
|
931
|
+
get value() {
|
|
932
|
+
return a();
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
}, wo = {
|
|
936
|
+
set: () => {
|
|
937
|
+
},
|
|
938
|
+
get: () => null,
|
|
939
|
+
pickColor: () => null,
|
|
940
|
+
dispose: () => {
|
|
941
|
+
}
|
|
942
|
+
}, bo = () => typeof document < "u" && typeof HTMLCanvasElement < "u", O = (e, o) => {
|
|
943
|
+
const a = document.createElement("canvas");
|
|
944
|
+
a.width = Math.max(1, Math.round(e)), a.height = Math.max(1, Math.round(o));
|
|
945
|
+
const n = a.getContext("2d", { willReadFrequently: !0 });
|
|
946
|
+
return n ? { canvas: a, context: n } : null;
|
|
947
|
+
}, A = (e, o, a) => {
|
|
948
|
+
const n = Math.max(1, Math.round(o)), t = Math.max(1, Math.round(a));
|
|
949
|
+
e.canvas.width === n && e.canvas.height === t || (e.canvas.width = n, e.canvas.height = t);
|
|
950
|
+
}, xo = (e) => {
|
|
951
|
+
const o = e.trim().replace("#", ""), a = o.length === 3 ? [...o].map((t) => `${t}${t}`).join("") : o;
|
|
952
|
+
if (!/^[0-9a-f]{6}$/i.test(a)) return null;
|
|
953
|
+
const n = Number.parseInt(a, 16);
|
|
954
|
+
return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
|
|
955
|
+
}, Mo = (e, o, a) => `#${[e, o, a].map(
|
|
956
|
+
(n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0")
|
|
957
|
+
).join("")}`, Te = (e, o, a, n, t) => {
|
|
958
|
+
const l = o.width, i = o.height, r = t.rotate === 90;
|
|
959
|
+
if (e.save(), e.translate(a / 2, n / 2), r && e.rotate(Math.PI / 2), t.fit === "fill" && !r && !t.overscan) {
|
|
960
|
+
e.drawImage(o, -a / 2, -n / 2, a, n), e.restore();
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
const c = r ? i : l, u = r ? l : i, x = (t.fit === "cover" ? Math.max(a / c, n / u) : Math.min(a / c, n / u)) * (t.overscan ?? 1), b = l * x, v = i * x;
|
|
964
|
+
e.drawImage(o, -b / 2, -v / 2, b, v), e.restore();
|
|
965
|
+
}, Co = (e) => {
|
|
966
|
+
if (!bo()) return wo;
|
|
967
|
+
const o = {}, a = o;
|
|
968
|
+
let n, t = null, l = null, i = null, r = null, c = null, u = null, d = 0, x = !1, b = -1;
|
|
969
|
+
const v = () => {
|
|
970
|
+
if (n) return;
|
|
971
|
+
ee();
|
|
972
|
+
const h = document.createElement("canvas");
|
|
973
|
+
h.className = Fe, t = h.getContext("2d"), e.template.$player.appendChild(h), n = h;
|
|
974
|
+
}, s = () => {
|
|
975
|
+
const h = Math.min(typeof window > "u" ? 1 : window.devicePixelRatio || 1, Ge), p = Math.max(1, Math.round(e.video.clientWidth * h)), m = Math.max(1, Math.round(e.video.clientHeight * h));
|
|
976
|
+
return n ? ((n.width !== p || n.height !== m) && (n.width = p, n.height = m), { width: p, height: m }) : { width: p, height: m };
|
|
977
|
+
}, f = (h, p) => {
|
|
978
|
+
const m = o.chromaKey ? pe : Qe, w = Math.min(1, m / Math.max(h, p)), M = Math.round(h * w), g = Math.round(p * w);
|
|
979
|
+
return l ? A(l, M, g) : l = O(M, g), l;
|
|
980
|
+
}, y = (h, p) => {
|
|
981
|
+
const m = xo(p.color);
|
|
982
|
+
if (!m) return;
|
|
983
|
+
const { width: w, height: M } = h.canvas;
|
|
984
|
+
let g;
|
|
985
|
+
try {
|
|
986
|
+
g = h.context.getImageData(0, 0, w, M);
|
|
987
|
+
} catch {
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
const k = g.data, z = Math.sqrt(3) * 255, T = Math.min(1, Math.max(0, p.similarity)) * z, S = Math.max(1, Math.min(1, Math.max(0, p.smoothness)) * z);
|
|
991
|
+
for (let $ = 0; $ < k.length; $ += 4) {
|
|
992
|
+
const P = k[$] - m.r, W = k[$ + 1] - m.g, N = k[$ + 2] - m.b, I = Math.sqrt(P * P + W * W + N * N);
|
|
993
|
+
I <= T ? k[$ + 3] = 0 : I < T + S && (k[$ + 3] = Math.round((I - T) / S * 255));
|
|
994
|
+
}
|
|
995
|
+
h.context.putImageData(g, 0, 0);
|
|
996
|
+
}, C = (h, p) => {
|
|
997
|
+
const m = Math.max(2, Math.round(p)), { width: w, height: M } = h.canvas, g = Math.max(1, Math.floor(w / m)), k = Math.max(1, Math.floor(M / m));
|
|
998
|
+
i ? A(i, g, k) : i = O(g, k), i && (i.context.imageSmoothingEnabled = !1, i.context.clearRect(0, 0, g, k), i.context.drawImage(h.canvas, 0, 0, g, k), h.context.imageSmoothingEnabled = !1, h.context.clearRect(0, 0, w, M), h.context.drawImage(i.canvas, 0, 0, g, k, 0, 0, w, M), h.context.imageSmoothingEnabled = !0);
|
|
999
|
+
}, F = () => {
|
|
1000
|
+
const h = [], p = e.video.style.filter;
|
|
1001
|
+
if (p && h.push(p), o.blur && o.blur.radius > 0 && h.push(`blur(${o.blur.radius}px)`), o.videoFilter) {
|
|
1002
|
+
const m = Le(o.videoFilter.preset, o.videoFilter.intensity);
|
|
1003
|
+
m && h.push(m);
|
|
1004
|
+
}
|
|
1005
|
+
return h.join(" ");
|
|
1006
|
+
}, L = () => {
|
|
1007
|
+
const h = o.vertical;
|
|
1008
|
+
if (h) return h.fit;
|
|
1009
|
+
if (o.backgroundBlur) return "contain";
|
|
1010
|
+
const p = e.video.style.objectFit;
|
|
1011
|
+
return p === "contain" || p === "cover" ? p : "fill";
|
|
1012
|
+
}, j = () => {
|
|
1013
|
+
if (!n || !t) return;
|
|
1014
|
+
const h = e.video;
|
|
1015
|
+
if (!h.videoWidth || !h.videoHeight) return;
|
|
1016
|
+
const p = f(h.videoWidth, h.videoHeight);
|
|
1017
|
+
if (!p) return;
|
|
1018
|
+
const { width: m, height: w } = p.canvas;
|
|
1019
|
+
p.context.clearRect(0, 0, m, w), p.context.drawImage(h, 0, 0, m, w), o.chromaKey && y(p, o.chromaKey), o.mosaic && C(p, o.mosaic.size);
|
|
1020
|
+
const { width: M, height: g } = s();
|
|
1021
|
+
if (r ? A(r, M, g) : r = O(M, g), !r) return;
|
|
1022
|
+
const k = o.vertical, z = L(), T = (k == null ? void 0 : k.rotate) ?? 0, S = F(), $ = o.backgroundBlur;
|
|
1023
|
+
r.context.clearRect(0, 0, M, g), $ && $.radius > 0 && (r.context.save(), r.context.filter = [`blur(${$.radius}px)`, S].filter(Boolean).join(" "), Te(r.context, p.canvas, M, g, {
|
|
1024
|
+
fit: "cover",
|
|
1025
|
+
rotate: 0,
|
|
1026
|
+
overscan: $.overscan
|
|
1027
|
+
}), r.context.restore()), r.context.save(), S && (r.context.filter = S), Te(r.context, p.canvas, M, g, { fit: z, rotate: T }), r.context.restore(), t.clearRect(0, 0, M, g), t.drawImage(r.canvas, 0, 0);
|
|
1028
|
+
const P = o.stabilizer;
|
|
1029
|
+
P && P.strength > 0 && r && (c ? A(c, M, g) : c = O(M, g), c && (t.globalAlpha = Math.min(0.9, Math.max(0, P.strength)), t.drawImage(c.canvas, 0, 0, M, g), t.globalAlpha = 1, c.context.clearRect(0, 0, M, g), c.context.drawImage(r.canvas, 0, 0)));
|
|
1030
|
+
}, Be = () => Object.values(o).some(Boolean), te = () => {
|
|
1031
|
+
if (x) return;
|
|
1032
|
+
d = requestAnimationFrame(te);
|
|
1033
|
+
const h = e.video;
|
|
1034
|
+
if (!n) return;
|
|
1035
|
+
const p = h.readyState >= 2 && h.videoWidth > 0;
|
|
1036
|
+
n.style.visibility = p ? "visible" : "hidden", p && (!e.playing && h.currentTime === b || (b = h.currentTime, j()));
|
|
1037
|
+
}, Ee = () => {
|
|
1038
|
+
v(), n && (n.style.visibility = "hidden"), b = -1, d || (d = requestAnimationFrame(te));
|
|
1039
|
+
}, ne = () => {
|
|
1040
|
+
d && cancelAnimationFrame(d), d = 0, b = -1, n && (n.style.visibility = "hidden");
|
|
1041
|
+
};
|
|
1042
|
+
return { set: (h, p) => {
|
|
1043
|
+
x || (p ? a[h] = p : delete a[h], Be() ? Ee() : ne());
|
|
1044
|
+
}, get: (h) => o[h] ?? null, pickColor: (h, p) => {
|
|
1045
|
+
var N;
|
|
1046
|
+
const m = e.video;
|
|
1047
|
+
if (!m.videoWidth || !m.videoHeight) return null;
|
|
1048
|
+
const w = m.getBoundingClientRect();
|
|
1049
|
+
if (!w.width || !w.height) return null;
|
|
1050
|
+
const M = L(), g = (((N = o.vertical) == null ? void 0 : N.rotate) ?? 0) === 90, k = h - w.left - w.width / 2, z = p - w.top - w.height / 2;
|
|
1051
|
+
let T, S;
|
|
1052
|
+
if (M === "fill" && !g)
|
|
1053
|
+
T = (h - w.left) / (w.width / m.videoWidth), S = (p - w.top) / (w.height / m.videoHeight);
|
|
1054
|
+
else {
|
|
1055
|
+
const I = g ? m.videoHeight : m.videoWidth, oe = g ? m.videoWidth : m.videoHeight, le = M === "cover" ? Math.max(w.width / I, w.height / oe) : Math.min(w.width / I, w.height / oe);
|
|
1056
|
+
T = (g ? z : k) / le + m.videoWidth / 2, S = (g ? -k : z) / le + m.videoHeight / 2;
|
|
1057
|
+
}
|
|
1058
|
+
if (T < 0 || S < 0 || T >= m.videoWidth || S >= m.videoHeight) return null;
|
|
1059
|
+
const $ = Math.min(1, pe / Math.max(m.videoWidth, m.videoHeight)), P = Math.max(1, Math.round(m.videoWidth * $)), W = Math.max(1, Math.round(m.videoHeight * $));
|
|
1060
|
+
if (u ? A(u, P, W) : u = O(P, W), !u) return null;
|
|
1061
|
+
try {
|
|
1062
|
+
u.context.drawImage(m, 0, 0, P, W);
|
|
1063
|
+
const I = u.context.getImageData(Math.floor(T * $), Math.floor(S * $), 1, 1).data;
|
|
1064
|
+
return Mo(I[0], I[1], I[2]);
|
|
1065
|
+
} catch {
|
|
1066
|
+
return null;
|
|
1067
|
+
}
|
|
1068
|
+
}, dispose: () => {
|
|
1069
|
+
x = !0, ne(), n == null || n.remove(), n = void 0, t = null, l = null, i = null, r = null, c = null, u = null;
|
|
1070
|
+
} };
|
|
1071
|
+
}, U = new Map(go.map((e) => [e.key, e])), Wo = (e) => (U.set(e.key, e), e), Ho = (e) => e, No = (e, o) => ({ key: e, setting: o }), Oo = (e) => U.get(e), Ao = () => [...U.values()], ko = (e) => typeof e == "string" ? { key: e } : e, $o = (e = []) => {
|
|
1072
|
+
const o = /* @__PURE__ */ new Map();
|
|
1073
|
+
return e.forEach((a) => {
|
|
1074
|
+
const n = ko(a), t = U.get(n.key);
|
|
267
1075
|
if (!t) {
|
|
268
|
-
console.warn(`[${
|
|
1076
|
+
console.warn(`[${ze}] 未注册的插件:${n.key}`);
|
|
269
1077
|
return;
|
|
270
1078
|
}
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
}), [...
|
|
274
|
-
},
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
1079
|
+
const l = n.setting, i = l ? { ...t.defaultConfig, ...l({ ...t.defaultConfig }) } : { ...t.defaultConfig };
|
|
1080
|
+
o.set(n.key, { definition: t, config: i });
|
|
1081
|
+
}), [...o.values()];
|
|
1082
|
+
}, Ro = (e) => {
|
|
1083
|
+
const o = [];
|
|
1084
|
+
let a, n;
|
|
1085
|
+
const t = (c) => (a ?? (a = Co(c)), a), l = (c) => (n ?? (n = yo(c)), n);
|
|
1086
|
+
return { plugins: e.map(({ definition: c, config: u }) => (d) => {
|
|
1087
|
+
const x = {
|
|
1088
|
+
art: d,
|
|
279
1089
|
// artplayer 的 setting.add 运行时返回菜单项,类型声明却写成了 setting 组件本身
|
|
280
|
-
setting: (
|
|
281
|
-
onCleanup: (
|
|
282
|
-
|
|
1090
|
+
setting: (b) => d.setting.add(b),
|
|
1091
|
+
onCleanup: (b) => {
|
|
1092
|
+
o.push(b);
|
|
1093
|
+
},
|
|
1094
|
+
get frame() {
|
|
1095
|
+
return t(d);
|
|
1096
|
+
},
|
|
1097
|
+
get cssFilter() {
|
|
1098
|
+
return l(d);
|
|
283
1099
|
}
|
|
284
1100
|
};
|
|
285
|
-
|
|
1101
|
+
c.install(x, u);
|
|
286
1102
|
}), dispose: () => {
|
|
287
|
-
|
|
1103
|
+
o.splice(0).forEach((c) => c()), a == null || a.dispose(), a = void 0, n == null || n.clear(), n = void 0;
|
|
288
1104
|
} };
|
|
289
|
-
},
|
|
1105
|
+
}, So = /* @__PURE__ */ We({
|
|
290
1106
|
name: "VideoPlayer",
|
|
291
1107
|
__name: "index",
|
|
292
1108
|
props: {
|
|
@@ -299,129 +1115,146 @@ const z = "@wapri/gplayer", K = "wa-player", Q = "16 / 9", G = {
|
|
|
299
1115
|
loop: { type: Boolean },
|
|
300
1116
|
volume: {},
|
|
301
1117
|
height: {},
|
|
302
|
-
plugins: { default: () => [] },
|
|
1118
|
+
plugins: { default: () => [...un] },
|
|
303
1119
|
options: { default: () => ({}) }
|
|
304
1120
|
},
|
|
305
1121
|
emits: ["ready", "play", "pause", "ended", "timeupdate", "volumechange", "ratechange", "seek", "error", "flip", "pip", "screenshot", "fullscreen", "fullscreen-web", "destroy"],
|
|
306
|
-
setup(e, { expose:
|
|
307
|
-
const
|
|
308
|
-
let
|
|
309
|
-
const
|
|
1122
|
+
setup(e, { expose: o, emit: a }) {
|
|
1123
|
+
const n = e, t = a, l = He(), i = Ne();
|
|
1124
|
+
let r;
|
|
1125
|
+
const c = Oe(() => ({
|
|
310
1126
|
position: "relative",
|
|
311
1127
|
width: "100%",
|
|
312
1128
|
background: "#000",
|
|
313
|
-
...
|
|
314
|
-
})),
|
|
315
|
-
|
|
316
|
-
},
|
|
317
|
-
const
|
|
318
|
-
if (!
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
|
|
1129
|
+
...n.height === void 0 ? { aspectRatio: hn } : { height: typeof n.height == "number" ? `${n.height}px` : n.height }
|
|
1130
|
+
})), u = (s) => {
|
|
1131
|
+
s.on("play", () => t("play")), s.on("pause", () => t("pause")), s.on("seek", (f, y) => t("seek", f, y)), s.on("flip", (f) => t("flip", f)), s.on("pip", (f) => t("pip", f)), s.on("screenshot", (f) => t("screenshot", f)), s.on("fullscreen", (f) => t("fullscreen", f)), s.on("fullscreenWeb", (f) => t("fullscreen-web", f)), s.on("error", (f, y) => t("error", f, y)), s.on("destroy", () => t("destroy")), s.on("video:ended", () => t("ended")), s.on("video:timeupdate", () => t("timeupdate")), s.on("video:volumechange", () => t("volumechange")), s.on("video:ratechange", () => t("ratechange"));
|
|
1132
|
+
}, d = (s) => {
|
|
1133
|
+
const f = l.value;
|
|
1134
|
+
if (!f || !n.url) return;
|
|
1135
|
+
const y = Ro($o(n.plugins));
|
|
1136
|
+
r = y.dispose;
|
|
1137
|
+
const C = new Z(An(n, f, y.plugins), (F) => {
|
|
1138
|
+
s != null && s.currentTime && (F.currentTime = s.currentTime), s != null && s.playing && F.play().catch(() => {
|
|
323
1139
|
}), t("ready");
|
|
324
1140
|
});
|
|
325
|
-
i.value =
|
|
326
|
-
},
|
|
327
|
-
var
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
var
|
|
331
|
-
const
|
|
332
|
-
|
|
1141
|
+
i.value = C, u(C);
|
|
1142
|
+
}, x = () => {
|
|
1143
|
+
var s;
|
|
1144
|
+
r == null || r(), r = void 0, (s = i.value) == null || s.destroy(), i.value = void 0;
|
|
1145
|
+
}, b = () => {
|
|
1146
|
+
var y, C;
|
|
1147
|
+
const s = ((y = i.value) == null ? void 0 : y.currentTime) ?? 0, f = ((C = i.value) == null ? void 0 : C.playing) ?? !1;
|
|
1148
|
+
x(), d({ currentTime: s, playing: f });
|
|
333
1149
|
};
|
|
334
|
-
return
|
|
335
|
-
() =>
|
|
336
|
-
(
|
|
1150
|
+
return B(
|
|
1151
|
+
() => n.url,
|
|
1152
|
+
(s) => {
|
|
337
1153
|
if (!i.value) {
|
|
338
|
-
|
|
1154
|
+
d();
|
|
339
1155
|
return;
|
|
340
1156
|
}
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
),
|
|
344
|
-
() =>
|
|
345
|
-
(
|
|
346
|
-
i.value &&
|
|
347
|
-
}
|
|
348
|
-
),
|
|
349
|
-
() =>
|
|
350
|
-
(
|
|
351
|
-
i.value &&
|
|
352
|
-
}
|
|
353
|
-
),
|
|
354
|
-
() =>
|
|
355
|
-
(
|
|
356
|
-
i.value &&
|
|
357
|
-
}
|
|
358
|
-
),
|
|
359
|
-
() =>
|
|
360
|
-
(
|
|
361
|
-
i.value &&
|
|
362
|
-
}
|
|
363
|
-
),
|
|
364
|
-
() =>
|
|
365
|
-
(
|
|
366
|
-
i.value &&
|
|
367
|
-
}
|
|
368
|
-
),
|
|
1157
|
+
s && (i.value.url = s);
|
|
1158
|
+
}
|
|
1159
|
+
), B(() => [n.plugins, n.options], b, { deep: !0 }), B(
|
|
1160
|
+
() => n.poster,
|
|
1161
|
+
(s) => {
|
|
1162
|
+
i.value && s && (i.value.poster = s);
|
|
1163
|
+
}
|
|
1164
|
+
), B(
|
|
1165
|
+
() => n.theme,
|
|
1166
|
+
(s) => {
|
|
1167
|
+
i.value && s && (i.value.theme = s);
|
|
1168
|
+
}
|
|
1169
|
+
), B(
|
|
1170
|
+
() => n.volume,
|
|
1171
|
+
(s) => {
|
|
1172
|
+
i.value && s !== void 0 && (i.value.volume = s);
|
|
1173
|
+
}
|
|
1174
|
+
), B(
|
|
1175
|
+
() => n.muted,
|
|
1176
|
+
(s) => {
|
|
1177
|
+
i.value && s !== void 0 && (i.value.muted = s);
|
|
1178
|
+
}
|
|
1179
|
+
), B(
|
|
1180
|
+
() => n.loop,
|
|
1181
|
+
(s) => {
|
|
1182
|
+
i.value && s !== void 0 && (i.value.video.loop = s);
|
|
1183
|
+
}
|
|
1184
|
+
), Ae(d), je(x), o({
|
|
369
1185
|
get player() {
|
|
370
1186
|
return i.value;
|
|
371
1187
|
},
|
|
372
1188
|
play: () => {
|
|
373
|
-
var
|
|
374
|
-
return (
|
|
1189
|
+
var s;
|
|
1190
|
+
return (s = i.value) == null ? void 0 : s.play();
|
|
375
1191
|
},
|
|
376
1192
|
pause: () => {
|
|
377
|
-
var
|
|
378
|
-
return (
|
|
1193
|
+
var s;
|
|
1194
|
+
return (s = i.value) == null ? void 0 : s.pause();
|
|
379
1195
|
},
|
|
380
1196
|
toggle: () => {
|
|
381
|
-
var
|
|
382
|
-
return (
|
|
1197
|
+
var s;
|
|
1198
|
+
return (s = i.value) == null ? void 0 : s.toggle();
|
|
383
1199
|
},
|
|
384
|
-
seek: (
|
|
385
|
-
i.value && (i.value.currentTime =
|
|
1200
|
+
seek: (s) => {
|
|
1201
|
+
i.value && (i.value.currentTime = s);
|
|
386
1202
|
},
|
|
387
|
-
screenshot: (
|
|
388
|
-
var
|
|
389
|
-
return (
|
|
1203
|
+
screenshot: (s) => {
|
|
1204
|
+
var f;
|
|
1205
|
+
return (f = i.value) == null ? void 0 : f.screenshot(s);
|
|
390
1206
|
},
|
|
391
|
-
fullscreen: (
|
|
392
|
-
i.value && (i.value.fullscreen =
|
|
1207
|
+
fullscreen: (s) => {
|
|
1208
|
+
i.value && (i.value.fullscreen = s ?? !i.value.fullscreen);
|
|
393
1209
|
}
|
|
394
|
-
}), (
|
|
1210
|
+
}), (s, f) => (Ve(), Ke("div", {
|
|
395
1211
|
ref_key: "containerRef",
|
|
396
|
-
ref:
|
|
397
|
-
class:
|
|
398
|
-
style:
|
|
1212
|
+
ref: l,
|
|
1213
|
+
class: _e(qe(dn)),
|
|
1214
|
+
style: De(c.value)
|
|
399
1215
|
}, null, 6));
|
|
400
1216
|
}
|
|
401
|
-
}),
|
|
402
|
-
const
|
|
403
|
-
return
|
|
404
|
-
e.name &&
|
|
405
|
-
},
|
|
406
|
-
},
|
|
1217
|
+
}), To = (e) => {
|
|
1218
|
+
const o = e;
|
|
1219
|
+
return o.install = (a) => {
|
|
1220
|
+
e.name && a.component(e.name, e);
|
|
1221
|
+
}, o;
|
|
1222
|
+
}, jo = To(So);
|
|
407
1223
|
export {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
1224
|
+
jo as VideoPlayer,
|
|
1225
|
+
Un as abLoopPlugin,
|
|
1226
|
+
Xn as aspectRatioPlugin,
|
|
1227
|
+
Yn as backgroundBlurPlugin,
|
|
1228
|
+
Qn as blurPlugin,
|
|
1229
|
+
go as builtinPlugins,
|
|
1230
|
+
Gn as chromaKeyPlugin,
|
|
1231
|
+
yo as createCssFilterStack,
|
|
1232
|
+
Co as createFrameRenderer,
|
|
1233
|
+
jo as default,
|
|
1234
|
+
un as defaultPlayerPlugins,
|
|
1235
|
+
hn as defaultPlayerRatio,
|
|
1236
|
+
Ho as definePlugin,
|
|
1237
|
+
Zn as filterPlugin,
|
|
1238
|
+
to as flipPlugin,
|
|
1239
|
+
Oo as getPlugin,
|
|
1240
|
+
no as introPlugin,
|
|
1241
|
+
Ao as listPlugins,
|
|
1242
|
+
oo as mosaicPlugin,
|
|
1243
|
+
lo as overlayPlugin,
|
|
1244
|
+
ze as packageName,
|
|
1245
|
+
ao as pipPlugin,
|
|
1246
|
+
io as playbackRatePlugin,
|
|
1247
|
+
No as pluginEntry,
|
|
1248
|
+
dn as prefix,
|
|
1249
|
+
Wo as registerPlugin,
|
|
1250
|
+
$o as resolvePlugins,
|
|
1251
|
+
ro as reversePlugin,
|
|
1252
|
+
ho as screenshotPlugin,
|
|
1253
|
+
mo as stabilizerPlugin,
|
|
1254
|
+
po as verticalPlugin,
|
|
1255
|
+
vo as videoFilterPlugin,
|
|
1256
|
+
X as videoFilterPresetLabels,
|
|
1257
|
+
cn as videoFilterPresetOrder,
|
|
1258
|
+
rn as videoFilterPresets,
|
|
1259
|
+
fo as webFullscreenPlugin
|
|
427
1260
|
};
|