@cloud-app-dev/vidc 2.2.0-alpha.2 → 2.2.0-alpha.6
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/.umirc.ts +0 -2
- package/es/AppContext/static.js +11 -6
- package/es/CheckGroupFixed/index.js +8 -6
- package/es/DeviceSelect/index.js +1 -1
- package/es/FullScreen/index.d.ts +14 -1
- package/es/FullScreen/index.js +7 -4
- package/es/HightLevel/index.js +1 -1
- package/es/List/GridList/Demo.js +13 -35
- package/es/List/GridList/data.json +710 -0
- package/es/List/GridList/index.d.ts +2 -2
- package/es/List/GridList/index.js +2 -1
- package/es/List/index.d.ts +3 -1
- package/es/List/index.js +4 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +1 -1
- package/es/Picture/component/MoveContent/index.js +2 -2
- package/es/Picture/demo.d.ts +2 -0
- package/es/Picture/demo.js +16 -0
- package/es/Picture/index.d.ts +2 -0
- package/es/Picture/index.js +7 -5
- package/es/Picture/interface.d.ts +136 -3
- package/es/Picture/utils.d.ts +0 -2
- package/es/Picture/utils.js +1 -1
- package/es/Player/api/index.js +1 -1
- package/es/Player/frontend_player.d.ts +1 -7
- package/es/Player/index.d.ts +2 -8
- package/es/Player/index.js +1 -7
- package/es/Player/player.d.ts +134 -1
- package/es/Player/segment_player.d.ts +1 -5
- package/es/Player/single_player.js +4 -3
- package/es/Player/style/timeline.css +1 -1
- package/es/PlayerExt/demo.d.ts +2 -0
- package/es/PlayerExt/demo.js +165 -0
- package/es/PlayerExt/index.css +13 -0
- package/es/PlayerExt/index.d.ts +42 -0
- package/es/PlayerExt/index.js +145 -0
- package/es/UserSelect/index.js +1 -1
- package/es/WorkerFlow/Form/EmptyUserSet.js +1 -1
- package/es/WorkerFlow/Form/FormAuth.js +1 -1
- package/es/WorkerFlow/Form/GroupSelect.js +1 -1
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +1 -1
- package/es/WorkerFlow/Form/LevelGroupSelect.js +1 -1
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +1 -1
- package/es/WorkerFlow/Form/UserSelect.js +1 -1
- package/es/WorkerFlow/Form/UserSelectModalContent.js +1 -1
- package/es/WorkerFlow/Form/UserSet.js +1 -1
- package/es/WorkerFlow/index.js +1 -1
- package/es/WorkerFlow/utils.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/utils.d.ts +2 -1
- package/es/utils.js +17 -1
- package/package.json +7 -8
- package/tsconfig.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { GridListItemData } from './interface';
|
|
2
|
+
import { GridListCell, GridListItemData } from './interface';
|
|
3
3
|
import './index.less';
|
|
4
4
|
export interface GridListProps<P> {
|
|
5
5
|
items: P[];
|
|
@@ -7,7 +7,7 @@ export interface GridListProps<P> {
|
|
|
7
7
|
getWindowMargin?: (windowHeight: number) => number;
|
|
8
8
|
getColumnCount: (elementWidth: number, gridGap: number) => number;
|
|
9
9
|
getItemData: (item: P, columnWidth: number) => GridListItemData;
|
|
10
|
-
renderItem: (item: P) => React.ReactNode;
|
|
10
|
+
renderItem: (item: P, cell: GridListCell<P>) => React.ReactNode;
|
|
11
11
|
fixedColumnWidth?: number;
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
@@ -36,10 +36,11 @@ function GridList(props, ref) {
|
|
|
36
36
|
key: cell.key,
|
|
37
37
|
style: {
|
|
38
38
|
height: cell.height,
|
|
39
|
+
width: cell.width,
|
|
39
40
|
gridColumnStart: "".concat(cell.columnNumber),
|
|
40
41
|
gridRowStart: getGridRowStart(cell, renderData)
|
|
41
42
|
}
|
|
42
|
-
}, props.renderItem(cell.item));
|
|
43
|
+
}, props.renderItem(cell.item, cell));
|
|
43
44
|
}))));
|
|
44
45
|
}
|
|
45
46
|
|
package/es/List/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { CheckListProps } from './interface';
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare function List(props: CheckListProps<any>): JSX.Element;
|
|
@@ -13,5 +13,7 @@ declare namespace List {
|
|
|
13
13
|
var DeviceList: typeof import("./DeviceList").default;
|
|
14
14
|
var ListExt: typeof import("./ListExt").default;
|
|
15
15
|
var DynamicDeviceList: typeof import("./DynamicDeviceList").default;
|
|
16
|
+
var GridList: React.ForwardRefExoticComponent<import("./GridList").GridListProps<any> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
var DynamicGridList: typeof import("./DynamicGridList").default;
|
|
16
18
|
}
|
|
17
19
|
export default List;
|
package/es/List/index.js
CHANGED
|
@@ -27,6 +27,8 @@ import CheckExt from './CheckExt';
|
|
|
27
27
|
import DeviceList from './DeviceList';
|
|
28
28
|
import ListExt from './ListExt';
|
|
29
29
|
import DynamicDeviceList from './DynamicDeviceList';
|
|
30
|
+
import GridList from './GridList';
|
|
31
|
+
import DynamicGridList from './DynamicGridList';
|
|
30
32
|
import "./index.css";
|
|
31
33
|
|
|
32
34
|
function List(props) {
|
|
@@ -175,4 +177,6 @@ List.VList = VList;
|
|
|
175
177
|
List.DeviceList = DeviceList;
|
|
176
178
|
List.ListExt = ListExt;
|
|
177
179
|
List.DynamicDeviceList = DynamicDeviceList;
|
|
180
|
+
List.GridList = GridList;
|
|
181
|
+
List.DynamicGridList = DynamicGridList;
|
|
178
182
|
export default List;
|
|
@@ -82,7 +82,7 @@ function RectInfo(_ref) {
|
|
|
82
82
|
return /*#__PURE__*/React.createElement("li", {
|
|
83
83
|
className: "info-item",
|
|
84
84
|
key: index,
|
|
85
|
-
title: v.
|
|
85
|
+
title: v.titleAttr
|
|
86
86
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
87
87
|
type: v.icon
|
|
88
88
|
}), /*#__PURE__*/React.createElement("span", {
|
|
@@ -8,7 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
8
8
|
|
|
9
9
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
10
|
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
12
|
|
|
13
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
18
18
|
|
|
19
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
20
|
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
22
|
|
|
23
23
|
import React from 'react';
|
|
24
24
|
import addEventListener from 'add-dom-event-listener';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "antd/lib/config-provider/style";
|
|
2
|
+
import _ConfigProvider from "antd/lib/config-provider";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Picture from '.';
|
|
5
|
+
export default function App() {
|
|
6
|
+
return /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
7
|
+
prefixCls: "cloudapp"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
style: {
|
|
10
|
+
width: 800,
|
|
11
|
+
height: 400
|
|
12
|
+
}
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Picture, {
|
|
14
|
+
imagePath: "https://x0.ifengimg.com/cmpp/fck/2020_30/65cca65a549d6c2_w1024_h578.jpg"
|
|
15
|
+
})));
|
|
16
|
+
}
|
package/es/Picture/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import './index.less';
|
|
|
4
4
|
declare function Picture({ className, width, height, minHeight, disabledDrag, imagePath, rects, isOpenSelect, disabledDrawMenu, menus, hasTool, fullScreenEle, ...props }: IPictureProps): JSX.Element;
|
|
5
5
|
declare namespace Picture {
|
|
6
6
|
var defaultProps: {
|
|
7
|
+
width: string;
|
|
8
|
+
height: string;
|
|
7
9
|
className: string;
|
|
8
10
|
minHeight: number;
|
|
9
11
|
disabledDrag: boolean;
|
package/es/Picture/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import Tools from './component/Tools';
|
|
|
23
23
|
import DrawRect from './component/DrawRect';
|
|
24
24
|
import WheelScale from './component/WheelScale';
|
|
25
25
|
import DefaultRects from './component/DefaultRects';
|
|
26
|
-
import { isFunction } from 'lodash';
|
|
26
|
+
import { isFunction } from 'lodash-es';
|
|
27
27
|
import "./index.css";
|
|
28
28
|
|
|
29
29
|
function Picture(_a) {
|
|
@@ -187,7 +187,7 @@ function Picture(_a) {
|
|
|
187
187
|
rotate = state.rotate;
|
|
188
188
|
|
|
189
189
|
if (!layoutRef.current) {
|
|
190
|
-
return;
|
|
190
|
+
return undefined;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
var position = computedBound(layoutRef.current, currrentPosition, scale, rotate);
|
|
@@ -266,8 +266,8 @@ function Picture(_a) {
|
|
|
266
266
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
267
267
|
className: "picture-view-layout ".concat(className),
|
|
268
268
|
style: {
|
|
269
|
-
width: width
|
|
270
|
-
height: height
|
|
269
|
+
width: width,
|
|
270
|
+
height: height,
|
|
271
271
|
minHeight: minHeight
|
|
272
272
|
},
|
|
273
273
|
ref: layoutRef,
|
|
@@ -323,7 +323,7 @@ function Picture(_a) {
|
|
|
323
323
|
setScale: setScale,
|
|
324
324
|
setRotate: setRotate,
|
|
325
325
|
scale: scale,
|
|
326
|
-
containerEle: fullScreenEle
|
|
326
|
+
containerEle: fullScreenEle !== null && fullScreenEle !== void 0 ? fullScreenEle : layoutRef.current,
|
|
327
327
|
resetPicture: resetPicture,
|
|
328
328
|
imgDownload: imgDownload,
|
|
329
329
|
fullScreenChange: loadImageSuccess
|
|
@@ -334,6 +334,8 @@ function Picture(_a) {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
Picture.defaultProps = {
|
|
337
|
+
width: '100%',
|
|
338
|
+
height: '100%',
|
|
337
339
|
className: '',
|
|
338
340
|
minHeight: 300,
|
|
339
341
|
disabledDrag: false,
|
|
@@ -1,37 +1,111 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
export type MenuRectType = {
|
|
4
|
+
/**
|
|
5
|
+
* 路由地址
|
|
6
|
+
*/
|
|
4
7
|
pathname: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 标题
|
|
11
|
+
*/
|
|
5
12
|
title: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 图标
|
|
16
|
+
*/
|
|
6
17
|
icon: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 内部属性,忽略
|
|
21
|
+
*/
|
|
7
22
|
base64?: string;
|
|
8
23
|
};
|
|
24
|
+
export const MenuRectTypeDemo: React.FC<MenuRectType>;
|
|
9
25
|
|
|
10
26
|
export type TagItemType = {
|
|
27
|
+
/**
|
|
28
|
+
* 标签值 code
|
|
29
|
+
*/
|
|
11
30
|
value: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 标签对应文本
|
|
34
|
+
*/
|
|
12
35
|
label: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 标签图标
|
|
39
|
+
*/
|
|
13
40
|
icon: string;
|
|
14
|
-
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
*标签title属性
|
|
44
|
+
*/
|
|
45
|
+
titleAttr?: string;
|
|
15
46
|
};
|
|
47
|
+
export const TagItemTypeDemo: React.FC<TagItemType>;
|
|
16
48
|
|
|
17
49
|
export type ImageType = 'face' | 'body' | 'nonVehicle' | 'vehicle' | 'thing';
|
|
18
50
|
|
|
19
51
|
export type RectType = {
|
|
52
|
+
/**
|
|
53
|
+
* 矩形框坐标 [left,top,width,height]
|
|
54
|
+
*/
|
|
20
55
|
rect: Array<number>;
|
|
56
|
+
/**
|
|
57
|
+
* 'face' | 'body' | 'nonVehicle' | 'vehicle' | 'thing'
|
|
58
|
+
*/
|
|
21
59
|
type: ImageType;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 矩形是否需要扩大,根据类型扩大计算公式
|
|
63
|
+
*/
|
|
22
64
|
needExpand?: boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 图片id
|
|
68
|
+
*/
|
|
23
69
|
imgId?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 矩形面积,通过面积控制矩形层级
|
|
73
|
+
*/
|
|
24
74
|
area?: number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 矩形中对象对应的标签
|
|
78
|
+
*/
|
|
25
79
|
tags?: TagItemType[];
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 小图的地址
|
|
83
|
+
*/
|
|
26
84
|
imgUrl?: string;
|
|
27
|
-
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 是否默认
|
|
88
|
+
*/
|
|
28
89
|
isDefault?: boolean;
|
|
29
|
-
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 重复标记
|
|
93
|
+
*/
|
|
30
94
|
dupId?: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 低质量标记
|
|
98
|
+
*/
|
|
31
99
|
lowQuality?: boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 内部属性,忽略
|
|
103
|
+
*/
|
|
32
104
|
base64?: string;
|
|
33
105
|
};
|
|
34
106
|
|
|
107
|
+
export const RectTypeDemo: React.FC<RectType>;
|
|
108
|
+
|
|
35
109
|
export type PositionType = {
|
|
36
110
|
x: number;
|
|
37
111
|
y: number;
|
|
@@ -50,20 +124,79 @@ export type SizeType = {
|
|
|
50
124
|
};
|
|
51
125
|
|
|
52
126
|
export interface IPictureProps {
|
|
127
|
+
/**
|
|
128
|
+
* 容器类名
|
|
129
|
+
*/
|
|
53
130
|
className?: string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 容器宽度
|
|
134
|
+
*/
|
|
54
135
|
width?: number | string;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 容器高度
|
|
139
|
+
*/
|
|
55
140
|
height?: number | string;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* 容器最小高度
|
|
144
|
+
*/
|
|
56
145
|
minHeight?: number | string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 进展拓展状态
|
|
149
|
+
*/
|
|
57
150
|
disabledDrag?: false;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 图片地址
|
|
154
|
+
*/
|
|
58
155
|
imagePath: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 目标框的对象
|
|
159
|
+
*/
|
|
59
160
|
rects?: RectType[];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 开启自定义框选
|
|
164
|
+
*/
|
|
60
165
|
isOpenSelect?: false;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 禁止框选 后的菜单项
|
|
169
|
+
*/
|
|
61
170
|
disabledDrawMenu?: false;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 框选 后的菜单项
|
|
174
|
+
*/
|
|
62
175
|
menus?: MenuRectType[];
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* 图片下载
|
|
179
|
+
*/
|
|
63
180
|
imgDownload?: () => void;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* 点击框事件
|
|
184
|
+
*/
|
|
64
185
|
onClickRect?: (item: RectType) => void;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 菜单点击事件
|
|
189
|
+
*/
|
|
65
190
|
onMenuClick?: (item: MenuRectType) => void;
|
|
66
191
|
children?: (option: any) => void;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 显示工具栏
|
|
195
|
+
*/
|
|
67
196
|
hasTool?: boolean;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 全屏的dom节点
|
|
200
|
+
*/
|
|
68
201
|
fullScreenEle?: Element;
|
|
69
202
|
}
|
package/es/Picture/utils.d.ts
CHANGED
|
@@ -13,9 +13,7 @@ export declare function computedRectScale({ imageSource, domImg, rects }: {
|
|
|
13
13
|
area?: number;
|
|
14
14
|
tags?: import("./interface").TagItemType[];
|
|
15
15
|
imgUrl?: string;
|
|
16
|
-
smId?: string;
|
|
17
16
|
isDefault?: boolean;
|
|
18
|
-
feature?: string;
|
|
19
17
|
dupId?: string;
|
|
20
18
|
lowQuality?: boolean;
|
|
21
19
|
base64?: string;
|
package/es/Picture/utils.js
CHANGED
package/es/Player/api/index.js
CHANGED
|
@@ -256,7 +256,7 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
|
|
|
256
256
|
video.removeAttribute('src');
|
|
257
257
|
setState({});
|
|
258
258
|
};
|
|
259
|
-
}, [url, container, segments]);
|
|
259
|
+
}, [url, container, segments, type]);
|
|
260
260
|
return [state.type, state.flv, state.hls];
|
|
261
261
|
} //创建Api
|
|
262
262
|
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
declare type OmitPlayerProps = 'customTimeLine' | 'onCanPlayerInit' | 'isLive' | 'reload' | 'type';
|
|
4
|
-
interface IFrontendPlayerProps extends Omit<ISinglePlayerProps, OmitPlayerProps> {
|
|
5
|
-
begin?: number;
|
|
6
|
-
end?: number;
|
|
7
|
-
onSeek(time: number): void;
|
|
8
|
-
}
|
|
2
|
+
import type { IFrontendPlayerProps } from './player';
|
|
9
3
|
/**
|
|
10
4
|
* @desc 主组件,负责片段整体逻辑控制
|
|
11
5
|
* @param param0
|
package/es/Player/index.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
declare const _default: {
|
|
4
|
-
SinglePlayer: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./player").ISinglePlayerProps & import("react").RefAttributes<import("./player").ExportPlayerType>>>;
|
|
5
|
-
FrontendPlayer: typeof FrontendPlayer;
|
|
6
|
-
SegmentPlayer: typeof SegmentPlayer;
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
1
|
+
import SinglePlayer from './single_player';
|
|
2
|
+
export default SinglePlayer;
|
package/es/Player/index.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import SinglePlayer from './single_player';
|
|
2
|
-
|
|
3
|
-
import FrontendPlayer from './frontend_player';
|
|
4
|
-
export default {
|
|
5
|
-
SinglePlayer: SinglePlayer,
|
|
6
|
-
FrontendPlayer: FrontendPlayer,
|
|
7
|
-
SegmentPlayer: SegmentPlayer
|
|
8
|
-
};
|
|
2
|
+
export default SinglePlayer;
|
package/es/Player/player.d.ts
CHANGED
|
@@ -10,34 +10,159 @@ export type FlvPlayerConfig = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export interface ISinglePlayerProps {
|
|
13
|
+
/**
|
|
14
|
+
* 视频播放地址
|
|
15
|
+
*/
|
|
13
16
|
url?: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 容器类名
|
|
20
|
+
*/
|
|
14
21
|
className?: string;
|
|
15
22
|
children?: React.ReactNode;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 同html video muted 静音
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
16
28
|
muted?: boolean;
|
|
17
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 同html video autoplay 自动播放
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
18
33
|
autoPlay?: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 同html video playsinline 自动播放
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
19
39
|
playsInline?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
*同html video preload 预加载
|
|
42
|
+
*/
|
|
20
43
|
preload?: string;
|
|
44
|
+
/**
|
|
45
|
+
* 视频封面
|
|
46
|
+
*/
|
|
21
47
|
poster?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 同html video loop 循环
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
22
53
|
loop?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 视频格式
|
|
57
|
+
* @default 'native'
|
|
58
|
+
*/
|
|
23
59
|
type?: 'flv' | 'hls' | 'native';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 隐藏工具栏
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
24
65
|
hideContrallerBar?: boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 直播模式
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
25
71
|
isLive?: boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 工具栏右外侧拓展
|
|
75
|
+
*/
|
|
26
76
|
rightExtContents?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* 工具栏右内侧拓展
|
|
79
|
+
*/
|
|
27
80
|
rightMidExtContents?: React.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* 工具栏左外侧拓展
|
|
83
|
+
*/
|
|
28
84
|
leftExtContents?: React.ReactNode;
|
|
85
|
+
/**
|
|
86
|
+
* 工具栏左内侧拓展
|
|
87
|
+
*/
|
|
29
88
|
leftMidExtContents?: React.ReactNode;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 自定义时间轴
|
|
92
|
+
*/
|
|
30
93
|
customTimeLine?: React.ReactNode;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 错误重试次数
|
|
97
|
+
* @default 5
|
|
98
|
+
*/
|
|
31
99
|
errorReloadTimer?: number;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 自定义flv参数配置
|
|
103
|
+
*/
|
|
32
104
|
flvConfig?: FlvPlayerConfig;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 自定义hls参数配置
|
|
108
|
+
*/
|
|
33
109
|
hlsConfig?: HlsConfig;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 自定义reload函数
|
|
113
|
+
*/
|
|
34
114
|
reload?: () => void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 视频可播放时执行钩子
|
|
118
|
+
*/
|
|
35
119
|
onCanPlayerInit?: () => void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 自定义video事件
|
|
123
|
+
*/
|
|
36
124
|
videoEvents?: CustomEvent[];
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 自定义播放器的事件
|
|
128
|
+
*/
|
|
37
129
|
playerEvents?: CustomEvent[];
|
|
38
130
|
}
|
|
39
131
|
|
|
132
|
+
type OmitPlayerProps = 'customTimeLine' | 'onCanPlayerInit' | 'isLive' | 'reload' | 'type';
|
|
133
|
+
|
|
134
|
+
export interface IFrontendPlayerProps extends Omit<ISinglePlayerProps, OmitPlayerProps> {
|
|
135
|
+
/**
|
|
136
|
+
* 前端录像开始时间
|
|
137
|
+
*/
|
|
138
|
+
begin?: number;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 前端录像结束时间
|
|
142
|
+
*/
|
|
143
|
+
end?: number;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 录像时间轴发生变化回调
|
|
147
|
+
*/
|
|
148
|
+
onSeek(time: number): void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface ISegmentPlayerProps extends Omit<ISinglePlayerProps, 'url' | 'customTimeLine' | 'onCanPlayerInit'> {
|
|
152
|
+
/**
|
|
153
|
+
* 云录像片段信息
|
|
154
|
+
*/
|
|
155
|
+
segments?: ISegmentType[];
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 云录像开始时间
|
|
159
|
+
*/
|
|
160
|
+
begin?: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
40
163
|
export const SinglePlayer: React.FunctionComponent<ISinglePlayerProps>;
|
|
164
|
+
export const FrontendPlayer: React.FunctionComponent<IFrontendPlayerProps>;
|
|
165
|
+
export const SegmentPlayer: React.FunctionComponent<ISegmentPlayerProps>;
|
|
41
166
|
|
|
42
167
|
export interface EventName {
|
|
43
168
|
RELOAD: 'reload'; //手动视频重载
|
|
@@ -68,8 +193,16 @@ export type ExportPlayerType = {
|
|
|
68
193
|
};
|
|
69
194
|
|
|
70
195
|
export interface ISegmentType {
|
|
196
|
+
/**
|
|
197
|
+
* 视频片段地址
|
|
198
|
+
*/
|
|
71
199
|
url?: string;
|
|
200
|
+
/**
|
|
201
|
+
* 视频片段长度 单位s(秒)
|
|
202
|
+
*/
|
|
72
203
|
duration: number;
|
|
73
204
|
}
|
|
74
205
|
|
|
206
|
+
export const ISegmentTypeDemo: React.FC<ISegmentType>;
|
|
207
|
+
|
|
75
208
|
export type CustomEvent = [string, () => void];
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
interface ISegmentPlayerProps extends Omit<ISinglePlayerProps, 'url' | 'customTimeLine' | 'onCanPlayerInit'> {
|
|
4
|
-
segments?: ISegmentType[];
|
|
5
|
-
begin?: number;
|
|
6
|
-
}
|
|
2
|
+
import type { ISegmentPlayerProps } from './player';
|
|
7
3
|
/**
|
|
8
4
|
* @desc 主组件,负责片段整体逻辑控制
|
|
9
5
|
* @param param0
|
|
@@ -55,11 +55,12 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
55
55
|
}),
|
|
56
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
57
|
state = _useState2[0],
|
|
58
|
-
setState = _useState2[1];
|
|
58
|
+
setState = _useState2[1]; // 视频格式判断,外部可以强制指定,也可以通过url自动判断
|
|
59
|
+
|
|
59
60
|
|
|
60
61
|
var vType = useMemo(function () {
|
|
61
62
|
return type || getVideoType(url);
|
|
62
|
-
}, [url]);
|
|
63
|
+
}, [url, type]);
|
|
63
64
|
var domRef = useRef(null);
|
|
64
65
|
var video = useMemo(function () {
|
|
65
66
|
return state.container ? state.container.querySelector('video') : undefined;
|
|
@@ -81,7 +82,7 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
81
82
|
|
|
82
83
|
var hasLink = useMemo(function () {
|
|
83
84
|
return !!url || !!flvConfig.mediaDataSource.segments && vType === 'flv';
|
|
84
|
-
}, [url, flvConfig.mediaDataSource.segments]); // 存储容器
|
|
85
|
+
}, [url, flvConfig.mediaDataSource.segments, vType]); // 存储容器
|
|
85
86
|
|
|
86
87
|
useEffect(function () {
|
|
87
88
|
setState(function (old) {
|