@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/README.md
CHANGED
|
@@ -31,7 +31,7 @@ import { VideoPlayer } from '@wapri/gplayer'
|
|
|
31
31
|
- 同一个 key 只安装一次,后出现的配置覆盖先出现的;未注册的 key 警告后跳过。
|
|
32
32
|
- 需要在 `setting` 里读字段时用 `pluginEntry('key', fn)`,`config` 会带上该插件的类型。
|
|
33
33
|
|
|
34
|
-
内置插件:`playbackRate`、`aspectRatio`、`flip`、`screenshot`、`pip`、`abLoop`、`filter
|
|
34
|
+
内置插件:`playbackRate`、`aspectRatio`、`flip`、`webFullscreen`、`screenshot`、`pip`、`abLoop`、`filter`、`videoFilter`、`mosaic`、`blur`、`backgroundBlur`、`stabilizer`、`chromaKey`、`vertical`、`reverse`、`intro`、`overlay`。不传 `plugins` 时只默认启用 `filter` 与 `webFullscreen`,其余按需声明。
|
|
35
35
|
|
|
36
36
|
自定义插件:
|
|
37
37
|
|
|
@@ -54,15 +54,15 @@ registerPlugin(
|
|
|
54
54
|
|
|
55
55
|
| 能力 | 说明 |
|
|
56
56
|
| --- | --- |
|
|
57
|
-
| Props | `url`、`poster`、`theme`、`lang`、`autoplay`、`muted`、`loop`、`volume`、`height`、`plugins`、`options` |
|
|
58
|
-
| Events | `ready`、`play`、`pause`、`ended`、`timeupdate`、`seek`、`error`、`volumechange`、`ratechange`、`flip`、`pip`、`screenshot`、`fullscreen`、`fullscreen-web`、`destroy` |
|
|
57
|
+
| Props | `url`、`poster`、`theme`、`lang`、`autoplay`、`muted`、`loop`、`volume`、`height`、`plugins`、`options` || Events | `ready`、`play`、`pause`、`ended`、`timeupdate`、`seek`、`error`、`volumechange`、`ratechange`、`flip`、`pip`、`screenshot`、`fullscreen`、`fullscreen-web`、`destroy` |
|
|
59
58
|
| 实例方法 | `player`、`play`、`pause`、`toggle`、`seek`、`screenshot`、`fullscreen` |
|
|
60
59
|
| 注册表 | `registerPlugin`、`definePlugin`、`pluginEntry`、`getPlugin`、`listPlugins`、`builtinPlugins` |
|
|
61
60
|
|
|
62
61
|
## 注意
|
|
63
62
|
|
|
64
63
|
- `plugins` 与 `options` 变化会重建实例,播放进度与播放状态会自动接上。
|
|
65
|
-
- 截图走 canvas
|
|
64
|
+
- 截图走 canvas 重绘,视频源需允许跨域;画面调节与视频滤镜会一起画进截图。
|
|
65
|
+
- 帧效果(马赛克、绿幕、背景模糊等)共用一层 canvas,跨域源需要服务端放行并在 `options` 里打开 `crossOrigin`;截图不含这些效果。
|
|
66
66
|
- HLS / FLV 等流协议由业务通过 `options.customType` 或 artplayer 生态插件接入。
|
|
67
67
|
|
|
68
68
|
## 在线文档
|
|
@@ -3,7 +3,7 @@ import { VideoPlayerInstance, VideoPlayerProps } from '../types/player';
|
|
|
3
3
|
export declare const VideoPlayer: import('../core/install').SFCWithInstall<import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
4
|
plugins: {
|
|
5
5
|
type: import('vue').PropType<import('..').PluginInput[]>;
|
|
6
|
-
default: () =>
|
|
6
|
+
default: () => import('..').PluginInput[];
|
|
7
7
|
};
|
|
8
8
|
url: {
|
|
9
9
|
type: import('vue').PropType<string>;
|
|
@@ -64,7 +64,7 @@ export declare const VideoPlayer: import('../core/install').SFCWithInstall<impor
|
|
|
64
64
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
65
65
|
plugins: {
|
|
66
66
|
type: import('vue').PropType<import('..').PluginInput[]>;
|
|
67
|
-
default: () =>
|
|
67
|
+
default: () => import('..').PluginInput[];
|
|
68
68
|
};
|
|
69
69
|
url: {
|
|
70
70
|
type: import('vue').PropType<string>;
|
|
@@ -3,7 +3,7 @@ import { FlipMode } from '../types/plugin';
|
|
|
3
3
|
import { VideoPlayerProps } from '../types/player';
|
|
4
4
|
|
|
5
5
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<VideoPlayerProps>, {
|
|
6
|
-
plugins: () =>
|
|
6
|
+
plugins: () => import('../types/plugin').PluginInput[];
|
|
7
7
|
options: () => {};
|
|
8
8
|
}>>, {
|
|
9
9
|
player: Artplayer | undefined;
|
|
@@ -30,7 +30,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
30
30
|
"fullscreen-web": (state: boolean) => void;
|
|
31
31
|
destroy: () => void;
|
|
32
32
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<VideoPlayerProps>, {
|
|
33
|
-
plugins: () =>
|
|
33
|
+
plugins: () => import('../types/plugin').PluginInput[];
|
|
34
34
|
options: () => {};
|
|
35
35
|
}>>> & Readonly<{
|
|
36
36
|
onScreenshot?: ((dataUri: string) => any) | undefined;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { VideoFilterPreset } from '../types/frame';
|
|
2
|
+
import { VerticalMode } from '../types/plugin';
|
|
3
|
+
|
|
4
|
+
/** 各插件在右侧菜单里的名称 */
|
|
5
|
+
export declare const webFullscreenLabel = "\u7F51\u9875\u5168\u5C4F";
|
|
6
|
+
export declare const mosaicLabel = "\u9A6C\u8D5B\u514B";
|
|
7
|
+
export declare const stabilizerLabel = "\u9632\u6296";
|
|
8
|
+
export declare const blurLabel = "\u6A21\u7CCA";
|
|
9
|
+
export declare const reverseLabel = "\u5012\u653E";
|
|
10
|
+
export declare const backgroundBlurLabel = "\u80CC\u666F\u6A21\u7CCA";
|
|
11
|
+
export declare const introLabel = "\u5F00\u573A\u52A8\u753B";
|
|
12
|
+
export declare const overlayLabel = "\u89C6\u9891\u53E0\u52A0";
|
|
13
|
+
export declare const chromaKeyLabel = "\u7EFF\u5E55";
|
|
14
|
+
export declare const videoFilterLabel = "\u89C6\u9891\u6EE4\u955C";
|
|
15
|
+
export declare const verticalLabel = "\u6A2A\u5C4F\u8F6C\u7AD6\u5C4F";
|
|
16
|
+
/** 帧渲染的工作画布长边上限,避免 4K 素材把帧率拖垮 */
|
|
17
|
+
export declare const frameMaxSide = 1280;
|
|
18
|
+
/** 绿幕要逐像素处理,工作画布再降一档 */
|
|
19
|
+
export declare const chromaKeyMaxSide = 960;
|
|
20
|
+
/** 覆盖层的最大像素比,高分屏上不再按真实 dpr 放大 */
|
|
21
|
+
export declare const frameMaxPixelRatio = 2;
|
|
22
|
+
/** 网页全屏插件的默认状态 */
|
|
23
|
+
export declare const defaultWebFullscreen = false;
|
|
24
|
+
/** 马赛克插件的默认取值与区间 */
|
|
25
|
+
export declare const defaultMosaicSize = 16;
|
|
26
|
+
export declare const mosaicMin = 2;
|
|
27
|
+
export declare const mosaicMax = 64;
|
|
28
|
+
export declare const mosaicStep = 1;
|
|
29
|
+
/** 防抖插件的默认取值与区间 */
|
|
30
|
+
export declare const defaultStabilizerStrength = 0.35;
|
|
31
|
+
export declare const stabilizerMin = 0;
|
|
32
|
+
export declare const stabilizerMax = 0.9;
|
|
33
|
+
export declare const stabilizerStep = 0.05;
|
|
34
|
+
/** 模糊插件的默认取值与区间 */
|
|
35
|
+
export declare const defaultBlurRadius = 6;
|
|
36
|
+
export declare const blurMin = 0;
|
|
37
|
+
export declare const blurMax = 30;
|
|
38
|
+
export declare const blurStep = 1;
|
|
39
|
+
/** 背景模糊插件的默认取值与区间 */
|
|
40
|
+
export declare const defaultBackgroundBlurRadius = 16;
|
|
41
|
+
export declare const backgroundBlurMin = 0;
|
|
42
|
+
export declare const backgroundBlurMax = 40;
|
|
43
|
+
export declare const backgroundBlurStep = 1;
|
|
44
|
+
/** 背景放大倍数,模糊后边缘不会露出黑边 */
|
|
45
|
+
export declare const backgroundBlurOverscan = 1.15;
|
|
46
|
+
/** 倒放插件的默认速率 */
|
|
47
|
+
export declare const defaultReverseRate = 1;
|
|
48
|
+
/** 开场动画插件的默认配置 */
|
|
49
|
+
export declare const defaultIntroText = "wapri";
|
|
50
|
+
export declare const defaultIntroDuration = 1600;
|
|
51
|
+
export declare const defaultIntroDelay = 0;
|
|
52
|
+
/** 视频叠加插件的默认配置,位置与宽度都按容器百分比 */
|
|
53
|
+
export declare const defaultOverlayX = 68;
|
|
54
|
+
export declare const defaultOverlayY = 68;
|
|
55
|
+
export declare const defaultOverlayWidth = 24;
|
|
56
|
+
export declare const defaultOverlayOpacity = 1;
|
|
57
|
+
export declare const overlayMinWidth = 6;
|
|
58
|
+
export declare const overlayMaxWidth = 80;
|
|
59
|
+
/** 绿幕插件的默认配置 */
|
|
60
|
+
export declare const defaultChromaColor = "#00ff00";
|
|
61
|
+
export declare const defaultChromaSimilarity = 0.35;
|
|
62
|
+
export declare const defaultChromaSmoothness = 0.12;
|
|
63
|
+
export declare const chromaSimilarityMin = 0;
|
|
64
|
+
export declare const chromaSimilarityMax = 1;
|
|
65
|
+
export declare const chromaSmoothnessMin = 0;
|
|
66
|
+
export declare const chromaSmoothnessMax = 0.6;
|
|
67
|
+
/** 视频滤镜插件的默认配置 */
|
|
68
|
+
export declare const defaultVideoFilterPreset: VideoFilterPreset;
|
|
69
|
+
export declare const defaultVideoFilterIntensity = 1;
|
|
70
|
+
export declare const videoFilterIntensityMin = 0;
|
|
71
|
+
export declare const videoFilterIntensityMax = 1;
|
|
72
|
+
export declare const videoFilterIntensityStep = 0.05;
|
|
73
|
+
/** 横屏转竖屏:目标容器比例与默认适配方式 */
|
|
74
|
+
export declare const verticalRatio = "9:16";
|
|
75
|
+
export declare const defaultVerticalMode: VerticalMode;
|
|
76
|
+
/** 各插件菜单项的补充文案 */
|
|
77
|
+
export declare const mosaicSizeText = "\u5757\u5927\u5C0F";
|
|
78
|
+
export declare const stabilizerStrengthText = "\u7A33\u50CF\u5F3A\u5EA6";
|
|
79
|
+
export declare const blurRadiusText = "\u6A21\u7CCA\u7A0B\u5EA6";
|
|
80
|
+
export declare const backgroundBlurRadiusText = "\u80CC\u666F\u6A21\u7CCA";
|
|
81
|
+
export declare const reverseRateText = "\u5012\u653E\u901F\u7387";
|
|
82
|
+
export declare const chromaPickText = "\u5438\u53D6\u80CC\u666F\u8272";
|
|
83
|
+
export declare const chromaPickTip = "\u70B9\u51FB\u753B\u9762\u53D6\u8272";
|
|
84
|
+
export declare const chromaSimilarityText = "\u76F8\u4F3C\u5EA6";
|
|
85
|
+
export declare const chromaSmoothnessText = "\u8FB9\u7F18\u7FBD\u5316";
|
|
86
|
+
export declare const chromaPickFailedText = "\u53D6\u8272\u5931\u8D25\uFF0C\u89C6\u9891\u6E90\u9700\u5F00\u542F\u8DE8\u57DF\uFF08CORS\uFF09";
|
|
87
|
+
export declare const videoFilterIntensityText = "\u5F3A\u5EA6";
|
|
88
|
+
export declare const verticalModeText = "\u9002\u914D\u65B9\u5F0F";
|
|
89
|
+
export declare const verticalModeCropText = "\u88C1\u5207\u94FA\u6EE1";
|
|
90
|
+
export declare const verticalModeContainText = "\u5B8C\u6574\u663E\u793A";
|
|
91
|
+
export declare const verticalModeRotateText = "\u65CB\u8F6C 90\u00B0";
|
|
92
|
+
export declare const introReplayText = "\u91CD\u64AD\u5F00\u573A";
|
|
93
|
+
export declare const overlayOpacityText = "\u900F\u660E\u5EA6";
|
|
94
|
+
export declare const overlayWidthText = "\u5927\u5C0F";
|
|
95
|
+
export declare const overlayResetText = "\u91CD\u7F6E\u4F4D\u7F6E";
|
|
96
|
+
export declare const overlayEmptyText = "\u672A\u914D\u7F6E\u53E0\u52A0\u7D20\u6750";
|
|
97
|
+
/** 覆盖层类名,统一带包前缀 */
|
|
98
|
+
export declare const introClassName = "wa-player-intro";
|
|
99
|
+
export declare const introTextClassName = "wa-player-intro__text";
|
|
100
|
+
export declare const introImageClassName = "wa-player-intro__image";
|
|
101
|
+
export declare const overlayClassName = "wa-player-overlay";
|
|
102
|
+
export declare const frameClassName = "wa-player-frame";
|
|
103
|
+
/** 覆盖层样式表的标记属性,注入一次后复用 */
|
|
104
|
+
export declare const styleElementFlag = "data-wa-player-style";
|
|
105
|
+
/** 覆盖层的 CSS,插件首次使用时注入 */
|
|
106
|
+
export declare const overlayStyleSheet = "\n.wa-player-frame {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 20;\n}\n.wa-player-intro {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: #000;\n opacity: 1;\n transition: opacity 400ms ease;\n pointer-events: none;\n z-index: 40;\n}\n.wa-player-intro--out {\n opacity: 0;\n}\n.wa-player-intro__image {\n max-width: 40%;\n max-height: 40%;\n object-fit: contain;\n animation: wa-player-intro-pop 600ms ease both;\n}\n.wa-player-intro__text {\n color: #fff;\n font-size: 20px;\n letter-spacing: 2px;\n animation: wa-player-intro-pop 600ms ease both;\n}\n.wa-player-overlay {\n position: absolute;\n z-index: 30;\n transform: translate(-50%, -50%);\n touch-action: none;\n user-select: none;\n}\n.wa-player-overlay--draggable {\n cursor: move;\n}\n.wa-player-overlay img,\n.wa-player-overlay video {\n display: block;\n width: 100%;\n height: auto;\n pointer-events: none;\n}\n@keyframes wa-player-intro-pop {\n from {\n opacity: 0;\n transform: scale(0.92);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VideoFilterPreset } from '../types/frame';
|
|
2
|
+
|
|
3
|
+
/** 预设滤镜的 CSS 片段,`intensity` 为 0–1 的强度 */
|
|
4
|
+
export type VideoFilterRenderer = (intensity: number) => string;
|
|
5
|
+
/**
|
|
6
|
+
* 视频滤镜预设。
|
|
7
|
+
* 参数按强度线性缩放,强度为 0 时退化成 `none`。
|
|
8
|
+
*/
|
|
9
|
+
export declare const videoFilterPresets: Record<VideoFilterPreset, VideoFilterRenderer>;
|
|
10
|
+
/** 预设的菜单文案 */
|
|
11
|
+
export declare const videoFilterPresetLabels: Record<VideoFilterPreset, string>;
|
|
12
|
+
/** 菜单里可选的预设顺序 */
|
|
13
|
+
export declare const videoFilterPresetOrder: VideoFilterPreset[];
|
|
14
|
+
/** 生成预设对应的 filter 片段,强度为 0 时返回空串 */
|
|
15
|
+
export declare const renderVideoFilter: (preset: VideoFilterPreset, intensity: number) => string;
|
package/dist/constant/icons.d.ts
CHANGED
|
@@ -2,3 +2,23 @@
|
|
|
2
2
|
export declare const abLoopIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M17 2l4 4-4 4V7H7a3 3 0 0 0-3 3v1H2v-1a5 5 0 0 1 5-5h10V2z\"/>\n <path d=\"M7 22l-4-4 4-4v3h10a3 3 0 0 0 3-3v-1h2v1a5 5 0 0 1-5 5H7v3z\"/>\n</svg>";
|
|
3
3
|
/** 画面调节:三条滑杆 */
|
|
4
4
|
export declare const filterIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M3 5h18v2H3V5zm0 6h18v2H3v-2zm0 6h18v2H3v-2z\" opacity=\".35\"/>\n <circle cx=\"8\" cy=\"6\" r=\"3\"/>\n <circle cx=\"15\" cy=\"12\" r=\"3\"/>\n <circle cx=\"10\" cy=\"18\" r=\"3\"/>\n</svg>";
|
|
5
|
+
/** 马赛克:四宫格 */
|
|
6
|
+
export declare const mosaicIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M3 3h6v6H3V3zm12 0h6v6h-6V3zM3 15h6v6H3v-6zm12 0h6v6h-6v-6z\"/>\n</svg>";
|
|
7
|
+
/** 防抖:准星 */
|
|
8
|
+
export declare const stabilizerIcon = "<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\">\n <circle cx=\"12\" cy=\"12\" r=\"6\"/>\n <path d=\"M12 2v4M12 18v4M2 12h4M18 12h4\"/>\n</svg>";
|
|
9
|
+
/** 模糊:由内到外淡出的圆 */
|
|
10
|
+
export declare const blurIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <circle cx=\"12\" cy=\"12\" r=\"9\" opacity=\".22\"/>\n <circle cx=\"12\" cy=\"12\" r=\"6\" opacity=\".5\"/>\n <circle cx=\"12\" cy=\"12\" r=\"3\"/>\n</svg>";
|
|
11
|
+
/** 倒放:向左的播放键 */
|
|
12
|
+
export declare const reverseIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M11 5v14l-8-7 8-7z\"/>\n <rect x=\"15\" y=\"5\" width=\"2.4\" height=\"14\" rx=\"1.2\"/>\n</svg>";
|
|
13
|
+
/** 背景模糊:外框虚、内框实 */
|
|
14
|
+
export declare const backgroundBlurIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <rect x=\"2\" y=\"2\" width=\"20\" height=\"20\" rx=\"3\" opacity=\".28\"/>\n <rect x=\"7\" y=\"6\" width=\"10\" height=\"12\" rx=\"2\"/>\n</svg>";
|
|
15
|
+
/** 开场动画:播放三角加星光 */
|
|
16
|
+
export declare const introIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" opacity=\".28\"/>\n <path d=\"M10 8.5v7l6-3.5-6-3.5z\"/>\n <path d=\"M18 2l.8 1.7 1.7.8-1.7.8L18 7l-.8-1.7-1.7-.8 1.7-.8L18 2z\"/>\n</svg>";
|
|
17
|
+
/** 视频叠加:图层 */
|
|
18
|
+
export declare const overlayIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M12 3l9 5-9 5-9-5 9-5z\"/>\n <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\"/>\n</svg>";
|
|
19
|
+
/** 绿幕:吸管 */
|
|
20
|
+
export declare const chromaKeyIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <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\"/>\n</svg>";
|
|
21
|
+
/** 视频滤镜:三色叠加 */
|
|
22
|
+
export declare const videoFilterIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <circle cx=\"9\" cy=\"9\" r=\"5.2\" opacity=\".7\"/>\n <circle cx=\"15\" cy=\"9\" r=\"5.2\" opacity=\".7\"/>\n <circle cx=\"12\" cy=\"14.5\" r=\"5.2\" opacity=\".7\"/>\n</svg>";
|
|
23
|
+
/** 横屏转竖屏:竖屏手机 */
|
|
24
|
+
export declare const verticalIcon = "<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\">\n <rect x=\"7\" y=\"2\" width=\"10\" height=\"20\" rx=\"2.2\"/>\n <path d=\"M10.5 18.5h3\"/>\n <path d=\"M3 7v4M3 11l1.6-1.6M3 11l1.6 1.6\" stroke-linecap=\"round\"/>\n</svg>";
|
package/dist/constant/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { AspectRatioValue, FlipMode, ScreenshotType } from '../types/plugin';
|
|
1
|
+
import { AspectRatioValue, FlipMode, PluginInput, ScreenshotType } from '../types/plugin';
|
|
2
2
|
|
|
3
|
+
export * from './effect';
|
|
4
|
+
export * from './filters';
|
|
5
|
+
/** 未传 `plugins` 时默认启用的插件:画面调节、网页全屏 */
|
|
6
|
+
export declare const defaultPlayerPlugins: PluginInput[];
|
|
3
7
|
/** 包名,用于日志与提示前缀 */
|
|
4
8
|
export declare const packageName = "@wapri/gplayer";
|
|
5
9
|
/** 组件类名前缀,同时用于根容器与自定义图标 */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SettingOption } from 'artplayer';
|
|
2
|
+
import { PluginContext } from '../types/plugin';
|
|
3
|
+
|
|
4
|
+
/** 菜单里「开关 + 滑杆」两行配置 */
|
|
5
|
+
export interface EffectMenuOptions {
|
|
6
|
+
/** 开关行文案 */
|
|
7
|
+
label: string;
|
|
8
|
+
/** 滑杆行文案 */
|
|
9
|
+
rangeLabel: string;
|
|
10
|
+
/** 两行共用的图标 */
|
|
11
|
+
icon: string;
|
|
12
|
+
/** 开关初始状态 */
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
/** 滑杆初始值 */
|
|
15
|
+
value: number;
|
|
16
|
+
min: number;
|
|
17
|
+
max: number;
|
|
18
|
+
step: number;
|
|
19
|
+
/** 切换开关 */
|
|
20
|
+
onToggle: (enabled: boolean) => void;
|
|
21
|
+
/** 拖动滑杆 */
|
|
22
|
+
onRange: (value: number) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface EffectMenu {
|
|
25
|
+
switchItem: SettingOption;
|
|
26
|
+
rangeItem: SettingOption;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 生成效果类插件通用的两行菜单。
|
|
30
|
+
* 开关行的 `onSwitch` 会回写自身状态,滑杆行的返回值写进右侧副标题。
|
|
31
|
+
*/
|
|
32
|
+
export declare const createEffectMenu: (context: Pick<PluginContext, "setting">, options: EffectMenuOptions) => EffectMenu;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as Artplayer } from 'artplayer';
|
|
2
|
+
import { FrameRenderer } from '../types/frame';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 帧渲染器:一个实例对应一个播放器,多个插件通过 `set()` 往里写自己的参数。
|
|
6
|
+
* 没有任何参数时不会创建 canvas,也不会启动循环。
|
|
7
|
+
*/
|
|
8
|
+
export declare const createFrameRenderer: (art: Artplayer) => FrameRenderer;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,11 @@ export { VideoPlayer, VideoPlayer as default } from './VideoPlayer';
|
|
|
2
2
|
export type { VideoPlayerInstance, VideoPlayerProps } from './VideoPlayer';
|
|
3
3
|
export { definePlugin, getPlugin, listPlugins, pluginEntry, registerPlugin, resolvePlugins } from './core/registry';
|
|
4
4
|
export { builtinPlugins } from './plugins';
|
|
5
|
-
export { abLoopPlugin, aspectRatioPlugin, filterPlugin, flipPlugin, pipPlugin, playbackRatePlugin, screenshotPlugin, } from './plugins';
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
5
|
+
export { abLoopPlugin, aspectRatioPlugin, backgroundBlurPlugin, blurPlugin, chromaKeyPlugin, filterPlugin, flipPlugin, introPlugin, mosaicPlugin, overlayPlugin, pipPlugin, playbackRatePlugin, reversePlugin, screenshotPlugin, stabilizerPlugin, verticalPlugin, videoFilterPlugin, webFullscreenPlugin, } from './plugins';
|
|
6
|
+
export { createCssFilterStack } from './core/cssFilter';
|
|
7
|
+
export { createFrameRenderer } from './core/frame';
|
|
8
|
+
export { defaultPlayerPlugins, defaultPlayerRatio, packageName, prefix } from './constant';
|
|
9
|
+
export { videoFilterPresetLabels, videoFilterPresetOrder, videoFilterPresets } from './constant';
|
|
10
|
+
export type { AbLoopConfig, AspectRatioConfig, AspectRatioValue, BackgroundBlurConfig, BlurConfig, BuiltinPluginKey, ChromaKeyConfig, CssFilterStack, FilterConfig, FlipConfig, FlipMode, IntroConfig, MosaicConfig, OverlayConfig, OverlayType, PipConfig, PlaybackRateConfig, PluginConfig, PluginConfigMap, PluginContext, PluginDefinition, PluginEntry, PluginInput, PluginSetting, RangeConfig, ResolvedPlugin, ReverseConfig, ScreenshotConfig, ScreenshotResult, ScreenshotType, StabilizerConfig, VerticalConfig, VerticalMode, VideoFilterConfig, WebFullscreenConfig, } from './types/plugin';
|
|
11
|
+
export type { BackgroundBlurEffect, BlurEffect, ChromaKeyEffect, FrameEffectKey, FrameEffectMap, FrameFit, FrameRenderer, MosaicEffect, StabilizerEffect, VerticalEffect, VideoFilterEffect, VideoFilterPreset, } from './types/frame';
|
|
8
12
|
export type { PlayerOption, VideoPlayerEmits } from './types/player';
|