@vtx/player 0.0.1 → 0.0.2
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/lib/index.es.js +533 -0
- package/lib/index.es.js.map +1 -0
- package/lib/index.umd.js +533 -0
- package/lib/index.umd.js.map +1 -0
- package/lib/types/api/fetch.d.ts +12 -0
- package/lib/types/api/index.d.ts +16 -0
- package/{src/api/types.ts → lib/types/api/types.d.ts} +7 -31
- package/lib/types/components/bill-player/index.d.ts +21 -0
- package/lib/types/components/controls/index.d.ts +52 -0
- package/lib/types/components/history-control/index.d.ts +39 -0
- package/lib/types/components/history-player/index.d.ts +31 -0
- package/lib/types/components/live-channel-player/index.d.ts +18 -0
- package/lib/types/components/live-control/index.d.ts +35 -0
- package/lib/types/components/live-player/index.d.ts +22 -0
- package/lib/types/components/player/index.d.ts +84 -0
- package/lib/types/context/index.d.ts +8 -0
- package/lib/types/hooks/useSettings.d.ts +9 -0
- package/lib/types/icons/index.d.ts +54 -0
- package/{src/main.ts → lib/types/main.d.ts} +0 -1
- package/lib/types/utils/index.d.ts +60 -0
- package/package.json +7 -5
- package/.eslintignore +0 -11
- package/.eslintrc.js +0 -31
- package/.prettierignore +0 -10
- package/.prettierrc.js +0 -22
- package/.storybook/main.js +0 -58
- package/.storybook/manager.js +0 -7
- package/.storybook/preview-head.html +0 -5
- package/.storybook/preview.js +0 -9
- package/.storybook/proxy.js +0 -6
- package/.storybook/theme.js +0 -8
- package/.stylelintrc.json +0 -13
- package/.vscode/extensions.json +0 -10
- package/.vscode/settings.json +0 -16
- package/commitlint.config.js +0 -10
- package/public/h5player.min.js +0 -311
- package/public/playctrl1/AudioRenderer.js +0 -225
- package/public/playctrl1/DecodeWorker.js +0 -711
- package/public/playctrl1/Decoder.js +0 -1
- package/public/playctrl1/SuperRender_10.js +0 -396
- package/public/playctrl2/Decoder.js +0 -21
- package/public/playctrl2/Decoder.wasm +0 -0
- package/public/playctrl2/Decoder.worker.js +0 -1
- package/public/playctrl3/Decoder.js +0 -21
- package/public/playctrl3/Decoder.wasm +0 -0
- package/public/playctrl3/Decoder.worker.js +0 -1
- package/rollup.config.js +0 -52
- package/src/api/fetch.ts +0 -50
- package/src/api/index.ts +0 -44
- package/src/components/bill-player/index.less +0 -58
- package/src/components/bill-player/index.stories.mdx +0 -24
- package/src/components/bill-player/index.stories.tsx +0 -14
- package/src/components/bill-player/index.tsx +0 -269
- package/src/components/controls/images/arrow.png +0 -0
- package/src/components/controls/images/error.png +0 -0
- package/src/components/controls/index.less +0 -182
- package/src/components/controls/index.tsx +0 -312
- package/src/components/history-control/images/collapse.png +0 -0
- package/src/components/history-control/index.less +0 -211
- package/src/components/history-control/index.stories.mdx +0 -64
- package/src/components/history-control/index.stories.tsx +0 -140
- package/src/components/history-control/index.tsx +0 -344
- package/src/components/history-player/index.less +0 -98
- package/src/components/history-player/index.stories.mdx +0 -38
- package/src/components/history-player/index.stories.tsx +0 -12
- package/src/components/history-player/index.tsx +0 -205
- package/src/components/live-channel-player/index.stories.mdx +0 -29
- package/src/components/live-channel-player/index.stories.tsx +0 -11
- package/src/components/live-channel-player/index.tsx +0 -79
- package/src/components/live-control/index.less +0 -65
- package/src/components/live-control/index.stories.mdx +0 -66
- package/src/components/live-control/index.stories.tsx +0 -69
- package/src/components/live-control/index.tsx +0 -255
- package/src/components/live-player/index.less +0 -71
- package/src/components/live-player/index.stories.mdx +0 -35
- package/src/components/live-player/index.stories.tsx +0 -12
- package/src/components/live-player/index.tsx +0 -118
- package/src/components/player/index.ts +0 -293
- package/src/context/index.ts +0 -13
- package/src/hooks/useSettings.tsx +0 -14
- package/src/icons/index.less +0 -27
- package/src/icons/index.tsx +0 -518
- package/src/stories/intro.stories.mdx +0 -16
- package/src/typings/@vtx/utils/index.d.ts +0 -27
- package/src/typings/h5player.d.ts +0 -133
- package/src/utils/index.ts +0 -177
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -24
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface VMFetchProps {
|
|
2
|
+
/** 请求体 */
|
|
3
|
+
data?: any;
|
|
4
|
+
/** 请求头 */
|
|
5
|
+
headersEx?: object;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 数据fetch总入口
|
|
9
|
+
* @param props
|
|
10
|
+
*/
|
|
11
|
+
declare const Fetch: <T>(url: string, type?: 'GET' | 'POST', params?: VMFetchProps) => Promise<T>;
|
|
12
|
+
export default Fetch;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Types from './types';
|
|
2
|
+
/** 获取预览地址 */
|
|
3
|
+
export declare const getPreviewUrl: (data: Types.GetPreviewUrlParams) => Promise<Types.GetPreviewUrlResp>;
|
|
4
|
+
/** 获取历史地址 */
|
|
5
|
+
export declare const getHistoryUrl: (data: Types.GetHistoryUrlParams) => Promise<Types.GetHistoryUrlResp>;
|
|
6
|
+
/** 获取视频信息 */
|
|
7
|
+
export declare const loadVideoInfo: (data: Types.LoadVideoInfoParams) => Promise<Types.LoadVideoInfoResp>;
|
|
8
|
+
/** 云台控制 */
|
|
9
|
+
export declare const cloudControl: (data: Types.CloudControlParams) => Promise<unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取通道信息
|
|
12
|
+
* @param channelId 通道ID
|
|
13
|
+
* @param tenantId 租户ID
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const loadVideoChannel: (channelId: string, tenantId: string) => Promise<Types.LoadVideoChannelResp>;
|
|
@@ -7,11 +7,11 @@ export interface GetPreviewUrlResp {
|
|
|
7
7
|
/** 设备名称 */
|
|
8
8
|
deviceName: string;
|
|
9
9
|
/** 设备ID */
|
|
10
|
-
deviceId:string;
|
|
10
|
+
deviceId: string;
|
|
11
11
|
/** 通道名称 */
|
|
12
12
|
channelName: string;
|
|
13
13
|
/** 通道编号 */
|
|
14
|
-
channelNum:string;
|
|
14
|
+
channelNum: string;
|
|
15
15
|
/** 播放器 */
|
|
16
16
|
player: string | null;
|
|
17
17
|
/** 是否可以对讲,1为可以,0为不可以 */
|
|
@@ -19,7 +19,6 @@ export interface GetPreviewUrlResp {
|
|
|
19
19
|
/** 云台类型,1全功能,2不能转动,3不能变焦,4无功能 */
|
|
20
20
|
ptzType?: 1 | 2 | 3 | 4;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
22
|
/** 获取预览地址Params */
|
|
24
23
|
export interface GetPreviewUrlParams {
|
|
25
24
|
/** 租户ID */
|
|
@@ -31,7 +30,6 @@ export interface GetPreviewUrlParams {
|
|
|
31
30
|
/** 协议 */
|
|
32
31
|
protocol?: string;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
/** 历史地址子项 */
|
|
36
34
|
export interface HistoryUrlItem {
|
|
37
35
|
/** 开始时间 */
|
|
@@ -43,7 +41,6 @@ export interface HistoryUrlItem {
|
|
|
43
41
|
/** 大小 */
|
|
44
42
|
size: number;
|
|
45
43
|
}
|
|
46
|
-
|
|
47
44
|
/** 获取历史地址Resp */
|
|
48
45
|
export interface GetHistoryUrlResp {
|
|
49
46
|
/** 设备名称 */
|
|
@@ -59,7 +56,6 @@ export interface GetHistoryUrlResp {
|
|
|
59
56
|
/** 地址 */
|
|
60
57
|
url: string;
|
|
61
58
|
}
|
|
62
|
-
|
|
63
59
|
/** 获取历史地址Params */
|
|
64
60
|
export interface GetHistoryUrlParams {
|
|
65
61
|
/** 租户ID */
|
|
@@ -75,7 +71,6 @@ export interface GetHistoryUrlParams {
|
|
|
75
71
|
/** 结束时间,格式:2022-06-01 23:59:59 */
|
|
76
72
|
endTime: string;
|
|
77
73
|
}
|
|
78
|
-
|
|
79
74
|
/** 获取视频信息Params */
|
|
80
75
|
export interface LoadVideoInfoParams {
|
|
81
76
|
/** 租户ID */
|
|
@@ -83,7 +78,6 @@ export interface LoadVideoInfoParams {
|
|
|
83
78
|
/** 业务ID */
|
|
84
79
|
billId: string;
|
|
85
80
|
}
|
|
86
|
-
|
|
87
81
|
export interface LoadVideoInfo {
|
|
88
82
|
/** 频道号 */
|
|
89
83
|
channelNum: string;
|
|
@@ -93,10 +87,9 @@ export interface LoadVideoInfo {
|
|
|
93
87
|
channelName: string;
|
|
94
88
|
}
|
|
95
89
|
/** 获取视频信息Resp */
|
|
96
|
-
export type LoadVideoInfoResp = LoadVideoInfo[];
|
|
97
|
-
|
|
90
|
+
export declare type LoadVideoInfoResp = LoadVideoInfo[];
|
|
98
91
|
/** 云台控制Params */
|
|
99
|
-
export type CloudControlParams = {
|
|
92
|
+
export declare type CloudControlParams = {
|
|
100
93
|
/** 租户ID */
|
|
101
94
|
tenantId: string;
|
|
102
95
|
/** 频道号 */
|
|
@@ -108,32 +101,15 @@ export type CloudControlParams = {
|
|
|
108
101
|
/** 命令 */
|
|
109
102
|
command: CloudControlCommandType;
|
|
110
103
|
};
|
|
111
|
-
|
|
112
104
|
/** 云台控制命令 */
|
|
113
|
-
export type CloudControlCommandType =
|
|
114
|
-
|
|
115
|
-
| 'RIGHT'
|
|
116
|
-
| 'UP'
|
|
117
|
-
| 'DOWN'
|
|
118
|
-
| 'LEFT_UP'
|
|
119
|
-
| 'LEFT_DOWN'
|
|
120
|
-
| 'RIGHT_UP'
|
|
121
|
-
| 'RIGHT_DOWN'
|
|
122
|
-
| 'ZOOM_IN'
|
|
123
|
-
| 'ZOOM_OUT'
|
|
124
|
-
| 'FOCUS_NEAR'
|
|
125
|
-
| 'FOCUS_FAR'
|
|
126
|
-
| 'IRIS_ENLARGE'
|
|
127
|
-
| 'IRIS_REDUCE';
|
|
128
|
-
|
|
129
|
-
export type LoadVideoChannelParams = {
|
|
105
|
+
export declare type CloudControlCommandType = 'LEFT' | 'RIGHT' | 'UP' | 'DOWN' | 'LEFT_UP' | 'LEFT_DOWN' | 'RIGHT_UP' | 'RIGHT_DOWN' | 'ZOOM_IN' | 'ZOOM_OUT' | 'FOCUS_NEAR' | 'FOCUS_FAR' | 'IRIS_ENLARGE' | 'IRIS_REDUCE';
|
|
106
|
+
export declare type LoadVideoChannelParams = {
|
|
130
107
|
/** 租户ID */
|
|
131
108
|
tenantId: string;
|
|
132
109
|
/** 通道ID */
|
|
133
110
|
videoChannelId: string;
|
|
134
111
|
};
|
|
135
|
-
|
|
136
|
-
export type LoadVideoChannelResp = {
|
|
112
|
+
export declare type LoadVideoChannelResp = {
|
|
137
113
|
/** 通道号 */
|
|
138
114
|
channelNum: string;
|
|
139
115
|
/** 设备ID */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { LoadVideoInfoParams } from '@/api/types';
|
|
4
|
+
interface BillPlayerProps {
|
|
5
|
+
/** 参数 */
|
|
6
|
+
params: LoadVideoInfoParams;
|
|
7
|
+
/** 宽度 */
|
|
8
|
+
width?: string | number;
|
|
9
|
+
/** 高度 */
|
|
10
|
+
height?: string | number;
|
|
11
|
+
/** 是否显示实时视频,默认为true */
|
|
12
|
+
live?: boolean;
|
|
13
|
+
/** 是否显示历史视频,默认为true */
|
|
14
|
+
history?: boolean;
|
|
15
|
+
/** 实时默认播放 */
|
|
16
|
+
defaultLivePlay?: boolean;
|
|
17
|
+
/** 历史默认播放 */
|
|
18
|
+
defaultHistoryPlay?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const BillPlayer: (props: BillPlayerProps) => JSX.Element;
|
|
21
|
+
export default BillPlayer;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './index.less';
|
|
3
|
+
import Player from '../player';
|
|
4
|
+
import { CloudControlParams } from '@/api/types';
|
|
5
|
+
interface VolumeControlProps {
|
|
6
|
+
container: HTMLDivElement | null;
|
|
7
|
+
player?: Player;
|
|
8
|
+
defaultValue?: number;
|
|
9
|
+
}
|
|
10
|
+
/** 音量控制 */
|
|
11
|
+
export declare const VolumeControl: (props: VolumeControlProps) => JSX.Element;
|
|
12
|
+
declare type SpeedValue = 0.5 | 1 | 2;
|
|
13
|
+
interface SpeedControlProps {
|
|
14
|
+
container: HTMLDivElement | null;
|
|
15
|
+
player?: Player;
|
|
16
|
+
defaultValue?: SpeedValue;
|
|
17
|
+
}
|
|
18
|
+
/** 速度控制 */
|
|
19
|
+
export declare const SpeedControl: (props: SpeedControlProps) => JSX.Element;
|
|
20
|
+
interface ErrorStateProps {
|
|
21
|
+
/** 重试回调 */
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const ErrorState: (props: ErrorStateProps) => JSX.Element;
|
|
25
|
+
export declare const LoadingState: () => JSX.Element;
|
|
26
|
+
interface PlayerHeaderProps {
|
|
27
|
+
/** 名称 */
|
|
28
|
+
name: string;
|
|
29
|
+
/** 关闭回调 */
|
|
30
|
+
onClose: () => void;
|
|
31
|
+
}
|
|
32
|
+
/** 播放器头部 */
|
|
33
|
+
export declare const PlayerHeader: (props: PlayerHeaderProps) => JSX.Element;
|
|
34
|
+
interface TalkControlProps {
|
|
35
|
+
/** 播放器 */
|
|
36
|
+
player?: Player;
|
|
37
|
+
/** 对讲url */
|
|
38
|
+
url: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 对讲控制器
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export declare const TalkControl: (props: TalkControlProps) => JSX.Element;
|
|
45
|
+
export declare type CloudControlType = 'all' | 'onlyFocus' | 'onlyRotate' | 'none';
|
|
46
|
+
export declare type CloudControlPanelProps = {
|
|
47
|
+
query: Omit<CloudControlParams, 'action' | 'command'>;
|
|
48
|
+
type: CloudControlType;
|
|
49
|
+
};
|
|
50
|
+
/** 云台控制面板 */
|
|
51
|
+
export declare const CloudControlPanel: (props: CloudControlPanelProps) => JSX.Element;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { GetHistoryUrlParams } from '@/api/types';
|
|
4
|
+
export declare type HistoryControlHandle = {
|
|
5
|
+
load: (channel: GetHistoryUrlParams) => void;
|
|
6
|
+
};
|
|
7
|
+
interface HistoryControlProps {
|
|
8
|
+
/** 宽度 */
|
|
9
|
+
width?: number;
|
|
10
|
+
/** 高度 */
|
|
11
|
+
height?: number;
|
|
12
|
+
/** 展开/收缩按钮回调 */
|
|
13
|
+
onExpandChange?: (expand: boolean) => void;
|
|
14
|
+
/** 播放器进度回调,time:YYYY-MM-DD HH:mm:ss */
|
|
15
|
+
onTimeChange?: (time: string) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 历史视频控制器
|
|
19
|
+
*/
|
|
20
|
+
export declare const HistoryControl: import("react").ForwardRefExoticComponent<HistoryControlProps & import("react").RefAttributes<HistoryControlHandle>>;
|
|
21
|
+
export declare type UrlsTableItemType = {
|
|
22
|
+
/** 序号 */
|
|
23
|
+
index: number;
|
|
24
|
+
/** 设备名称 */
|
|
25
|
+
deviceName: string;
|
|
26
|
+
/** 通道名称 */
|
|
27
|
+
channelName: string;
|
|
28
|
+
/** 开始时间 */
|
|
29
|
+
beginTime: string;
|
|
30
|
+
/** 结束时间 */
|
|
31
|
+
endTime: string;
|
|
32
|
+
/** 视频时长 */
|
|
33
|
+
duration: string;
|
|
34
|
+
/** 视频大小 */
|
|
35
|
+
size: string;
|
|
36
|
+
/** 地址 */
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
39
|
+
export default HistoryControl;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { VideoType } from '@/components/player';
|
|
4
|
+
export declare type HistoryPlayerHandle = {
|
|
5
|
+
/**
|
|
6
|
+
* 跳转,目前仅支持海康视频跳转
|
|
7
|
+
*/
|
|
8
|
+
seekTo: (time: string) => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
interface VtxPlayerProps {
|
|
11
|
+
/** 视频流地址 */
|
|
12
|
+
url: string;
|
|
13
|
+
/** 视频流格式,如果为空则根据url自行判断 */
|
|
14
|
+
type?: VideoType;
|
|
15
|
+
/** 开始时间,格式为:YYYY-MM-DD HH:mm:ss */
|
|
16
|
+
startTime: string;
|
|
17
|
+
/** 结束时间,格式为:YYYY-MM-DD HH:mm:ss */
|
|
18
|
+
endTime: string;
|
|
19
|
+
/** 宽度 */
|
|
20
|
+
width?: number;
|
|
21
|
+
/** 高度 */
|
|
22
|
+
height?: number;
|
|
23
|
+
/** 截图文件名 */
|
|
24
|
+
captureName?: string;
|
|
25
|
+
/** 控制条bottom */
|
|
26
|
+
controlBottom?: number;
|
|
27
|
+
/** 播放器进度回调,time:YYYY-MM-DD HH:mm:ss */
|
|
28
|
+
onTimeChange?: (time: string) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const HistoryPlayer: import("react").ForwardRefExoticComponent<VtxPlayerProps & import("react").RefAttributes<HistoryPlayerHandle>>;
|
|
31
|
+
export default HistoryPlayer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface LiveChannelPlayerProps {
|
|
3
|
+
/** 通道ID */
|
|
4
|
+
channelId: string;
|
|
5
|
+
/** 租户ID */
|
|
6
|
+
tenantId: string;
|
|
7
|
+
/** 宽度 */
|
|
8
|
+
width?: number;
|
|
9
|
+
/** 高度 */
|
|
10
|
+
height?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 基于通道ID的实时播放器
|
|
14
|
+
* @param props
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare const LiveChannelPlayer: (props: LiveChannelPlayerProps) => JSX.Element | undefined;
|
|
18
|
+
export default LiveChannelPlayer;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './index.less';
|
|
3
|
+
export declare type LiveControlHandle = {
|
|
4
|
+
/** 加载视频 */
|
|
5
|
+
load: (channel: ChannelType) => void;
|
|
6
|
+
/** 卸载视频,参数为通道编号 */
|
|
7
|
+
unLoad: (channelNum: string) => void;
|
|
8
|
+
/** 一次加载多个视频,适用于初始化 */
|
|
9
|
+
multiLoad: (channels: ChannelType[]) => void;
|
|
10
|
+
};
|
|
11
|
+
interface LiveControlProps {
|
|
12
|
+
/** 展开/收缩按钮回调 */
|
|
13
|
+
onExpandChange?: (expand: boolean) => void;
|
|
14
|
+
/** 视频关闭回调,参数为通道编号数组 */
|
|
15
|
+
onChannelChange?: (channelSNum: string[]) => void;
|
|
16
|
+
/** 宽度 */
|
|
17
|
+
width?: number | string;
|
|
18
|
+
/** 高度 */
|
|
19
|
+
height?: number | string;
|
|
20
|
+
}
|
|
21
|
+
export declare type ChannelType = {
|
|
22
|
+
/** 通道号 */
|
|
23
|
+
channelNum: string;
|
|
24
|
+
/** 设备ID */
|
|
25
|
+
deviceId?: string;
|
|
26
|
+
/** 租户ID */
|
|
27
|
+
tenantId?: string;
|
|
28
|
+
/** 协议 */
|
|
29
|
+
protocol?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 实时分屏组件
|
|
33
|
+
*/
|
|
34
|
+
declare const LiveControl: import("react").ForwardRefExoticComponent<LiveControlProps & import("react").RefAttributes<LiveControlHandle>>;
|
|
35
|
+
export default LiveControl;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { CloudControlPanelProps } from '@/components/controls';
|
|
4
|
+
import { VideoType } from '@/components/player';
|
|
5
|
+
interface VtxPlayerProps {
|
|
6
|
+
/** 视频流地址 */
|
|
7
|
+
url: string;
|
|
8
|
+
/** 宽度 */
|
|
9
|
+
width?: number;
|
|
10
|
+
/** 高度 */
|
|
11
|
+
height?: number;
|
|
12
|
+
/** 视频流格式,如果为空则根据url自行判断 */
|
|
13
|
+
type?: VideoType;
|
|
14
|
+
/** 截图文件名 */
|
|
15
|
+
captureName?: string;
|
|
16
|
+
/** 对讲地址 */
|
|
17
|
+
talkUrl?: string;
|
|
18
|
+
/** 云台控制 */
|
|
19
|
+
cloudParams?: CloudControlPanelProps;
|
|
20
|
+
}
|
|
21
|
+
export declare const LivePlayer: (props: VtxPlayerProps) => JSX.Element;
|
|
22
|
+
export default LivePlayer;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
/** 视频流格式 */
|
|
3
|
+
export declare type VideoType = 'flv' | 'hls' | 'hk_ws';
|
|
4
|
+
interface ConstructorParams {
|
|
5
|
+
url: string;
|
|
6
|
+
/** 渲染容器 */
|
|
7
|
+
container: HTMLDivElement;
|
|
8
|
+
/** 是否直播,flv.js需要 */
|
|
9
|
+
live?: boolean;
|
|
10
|
+
/** 视频流格式 */
|
|
11
|
+
type?: VideoType;
|
|
12
|
+
/** 开始时间,历史回放需要 */
|
|
13
|
+
startTime?: moment.MomentInput;
|
|
14
|
+
/** 结束时间,历史回放需要 */
|
|
15
|
+
endTime?: moment.MomentInput;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 视频播放核心类
|
|
19
|
+
*/
|
|
20
|
+
declare class Player {
|
|
21
|
+
/** 视频地址 */
|
|
22
|
+
url: string;
|
|
23
|
+
/** 视频流格式 */
|
|
24
|
+
type: VideoType;
|
|
25
|
+
private player;
|
|
26
|
+
private video;
|
|
27
|
+
/** 开始时间,历史回放需要 */
|
|
28
|
+
private startTime?;
|
|
29
|
+
/** 结束时间,历史回放需要 */
|
|
30
|
+
private endTime?;
|
|
31
|
+
/** 跳转时间,用于处理进度条位置 */
|
|
32
|
+
private seekTime?;
|
|
33
|
+
/** 之前的视频播放速度,用于处理海康音量控制 */
|
|
34
|
+
private preSpeed;
|
|
35
|
+
constructor(params: ConstructorParams);
|
|
36
|
+
/** 播放 */
|
|
37
|
+
play(): Promise<void>;
|
|
38
|
+
/** 回放 */
|
|
39
|
+
playBack(): Promise<void>;
|
|
40
|
+
/** 销毁 */
|
|
41
|
+
destroy(): void;
|
|
42
|
+
/** 截图 */
|
|
43
|
+
capture(captureName?: string, time?: boolean): void;
|
|
44
|
+
/** 尺寸重置 */
|
|
45
|
+
resize(): void;
|
|
46
|
+
/**
|
|
47
|
+
* 设置音量
|
|
48
|
+
* @param value
|
|
49
|
+
*/
|
|
50
|
+
setVolume(value: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* 设置播放速度
|
|
53
|
+
* @param speed
|
|
54
|
+
*/
|
|
55
|
+
setSpeed(speed: 0.5 | 1 | 2): void;
|
|
56
|
+
/**
|
|
57
|
+
* 时间更新事件
|
|
58
|
+
* @param callback 回调函数
|
|
59
|
+
*/
|
|
60
|
+
onTimeUpdate(callback: (currentTime: number) => void): void;
|
|
61
|
+
/** 跳转到 */
|
|
62
|
+
seekTo(time: number): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* 暂停播放
|
|
65
|
+
* @param callback 回调函数
|
|
66
|
+
*/
|
|
67
|
+
pause(callback?: () => void): void;
|
|
68
|
+
/**
|
|
69
|
+
* 恢复播放
|
|
70
|
+
* @param callback 回调函数
|
|
71
|
+
*/
|
|
72
|
+
resume(callback?: () => void): void;
|
|
73
|
+
/**
|
|
74
|
+
* 开始对讲
|
|
75
|
+
* @param url 对讲地址
|
|
76
|
+
*/
|
|
77
|
+
startTalk(url: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* 开始对讲
|
|
80
|
+
* @param state 状态
|
|
81
|
+
*/
|
|
82
|
+
stopTalk(): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
export default Player;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
import { MouseEventHandler } from 'react';
|
|
3
|
+
import type { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon';
|
|
4
|
+
interface IconProps extends Partial<CustomIconComponentProps> {
|
|
5
|
+
onClick?: MouseEventHandler<HTMLSpanElement>;
|
|
6
|
+
}
|
|
7
|
+
interface ActiveIconProps extends IconProps {
|
|
8
|
+
active?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** 暂停Icon */
|
|
11
|
+
export declare const PauseIcon: (props: IconProps) => JSX.Element;
|
|
12
|
+
/** 播放Icon */
|
|
13
|
+
export declare const PlayIcon: (props: IconProps) => JSX.Element;
|
|
14
|
+
/** 截图Icon */
|
|
15
|
+
export declare const CaptureIcon: (props: IconProps) => JSX.Element;
|
|
16
|
+
/** 全屏Icon */
|
|
17
|
+
export declare const FullScreenIcon: (props: IconProps) => JSX.Element;
|
|
18
|
+
/** 退出全屏Icon */
|
|
19
|
+
export declare const ExitFullScreenIcon: (props: IconProps) => JSX.Element;
|
|
20
|
+
/** 音量低Icon */
|
|
21
|
+
export declare const VolumeSmallIcon: (props: IconProps) => JSX.Element;
|
|
22
|
+
/** 音量高Icon */
|
|
23
|
+
export declare const VolumeLargeIcon: (props: IconProps) => JSX.Element;
|
|
24
|
+
/** 静音Icon */
|
|
25
|
+
export declare const VolumeMutedIcon: (props: IconProps) => JSX.Element;
|
|
26
|
+
/** 设置Icon */
|
|
27
|
+
export declare const SettingsIcon: (props: IconProps) => JSX.Element;
|
|
28
|
+
/** 关闭全部Icon */
|
|
29
|
+
export declare const CloseAllIcon: (props: IconProps) => JSX.Element;
|
|
30
|
+
/** 展开Icon */
|
|
31
|
+
export declare const ExpandIcon: (props: IconProps) => JSX.Element;
|
|
32
|
+
/** 收缩Icon */
|
|
33
|
+
export declare const FoldIcon: (props: IconProps) => JSX.Element;
|
|
34
|
+
/** 停止对讲Icon */
|
|
35
|
+
export declare const TalkDisableIcon: (props: ActiveIconProps) => JSX.Element;
|
|
36
|
+
/** 对讲Icon */
|
|
37
|
+
export declare const TalkIcon: (props: ActiveIconProps) => JSX.Element;
|
|
38
|
+
/** 云台控制 */
|
|
39
|
+
export declare const CloudControlIcon: (props: ActiveIconProps) => JSX.Element;
|
|
40
|
+
/** 1x1网格Icon */
|
|
41
|
+
export declare const Grid1x1Icon: (props: ActiveIconProps) => JSX.Element;
|
|
42
|
+
/** 2x2网格Icon */
|
|
43
|
+
export declare const Grid2x2Icon: (props: ActiveIconProps) => JSX.Element;
|
|
44
|
+
/** 3x3网格Icon */
|
|
45
|
+
export declare const Grid3x3Icon: (props: ActiveIconProps) => JSX.Element;
|
|
46
|
+
/** 关闭Icon */
|
|
47
|
+
export declare const CloseIcon: (props: IconProps) => JSX.Element;
|
|
48
|
+
/** 视频播放Icon */
|
|
49
|
+
export declare const VideoPlayIcon: (props: ActiveIconProps) => JSX.Element;
|
|
50
|
+
/** 视频关闭Icon */
|
|
51
|
+
export declare const VideoCloseIcon: (props: ActiveIconProps) => JSX.Element;
|
|
52
|
+
/** 时间刻度Icon */
|
|
53
|
+
export declare const TimePositionIcon: (props: IconProps) => JSX.Element;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
import { GetHistoryUrlResp } from '@/api/types';
|
|
3
|
+
import { UrlsTableItemType } from '@/components/history-control';
|
|
4
|
+
import { VideoType } from '@/components/player';
|
|
5
|
+
/** 时间格式枚举 */
|
|
6
|
+
export declare enum TimeFormat {
|
|
7
|
+
default = "YYYY-MM-DDTHH:mm:ss",
|
|
8
|
+
params = "YYYY-MM-DD HH:mm:ss",
|
|
9
|
+
url = "YYYYMMDDTHHmmss"
|
|
10
|
+
}
|
|
11
|
+
/** 生成随机ID */
|
|
12
|
+
export declare const guidGenerator: () => string;
|
|
13
|
+
declare type PlayerParams = {
|
|
14
|
+
/** 视频流地址 */
|
|
15
|
+
url: string;
|
|
16
|
+
/** 视频流格式 */
|
|
17
|
+
type: VideoType;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 获取视频直播地址及格式
|
|
21
|
+
* @param url
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export declare const getPlayerParams: (url: string, live: boolean, startTime?: moment.MomentInput, endTime?: moment.MomentInput) => PlayerParams;
|
|
25
|
+
/**
|
|
26
|
+
* 获取历史回放表格数据
|
|
27
|
+
* @param data
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export declare const getUrlTableData: (data: GetHistoryUrlResp) => UrlsTableItemType[];
|
|
31
|
+
/**
|
|
32
|
+
* 秒数=>00:00:00
|
|
33
|
+
* @param total
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare const secondsToTime: (total: number) => string;
|
|
37
|
+
/**
|
|
38
|
+
* 获取海康时间参数
|
|
39
|
+
* @param time 时间
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export declare const getHKTimeString: (time: moment.MomentInput) => string;
|
|
43
|
+
/**
|
|
44
|
+
* 获取海康分段播放地址
|
|
45
|
+
* @param totalUrl 总播放地址
|
|
46
|
+
* @param startTime 开始时间
|
|
47
|
+
* @param endTime 结束时间
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export declare const getHKListUrl: (totalUrl: string, startTime: moment.MomentInput, endTime: moment.MomentInput) => string;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* 获取flv格式分段播放地址
|
|
54
|
+
* @param totalUrl 总播放地址
|
|
55
|
+
* @param startTime 开始时间
|
|
56
|
+
* @param endTime 结束时间
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
export declare const getFlvListUrl: (totalUrl: string, startTime: moment.MomentInput, endTime: moment.MomentInput) => string;
|
|
60
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtx/player",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "视频业务组件",
|
|
6
|
-
"main": "./
|
|
7
|
-
"module": "./
|
|
8
|
-
"types": "./
|
|
9
|
-
"
|
|
6
|
+
"main": "./lib/index.umd.js",
|
|
7
|
+
"module": "./lib/index.es.js",
|
|
8
|
+
"types": "./lib/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib"
|
|
11
|
+
],
|
|
10
12
|
"scripts": {
|
|
11
13
|
"start": "start-storybook -p 6006",
|
|
12
14
|
"build": "npm run clean && rollup --config",
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
extends: [
|
|
4
|
-
'eslint:recommended',
|
|
5
|
-
'plugin:react/recommended',
|
|
6
|
-
'plugin:@typescript-eslint/recommended',
|
|
7
|
-
'prettier',
|
|
8
|
-
'plugin:storybook/recommended',
|
|
9
|
-
],
|
|
10
|
-
parserOptions: {
|
|
11
|
-
ecmaVersion: 'latest',
|
|
12
|
-
sourceType: 'module',
|
|
13
|
-
ecmaFeatures: {
|
|
14
|
-
jsx: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
plugins: ['react', 'react-hooks', '@typescript-eslint', 'prettier'],
|
|
18
|
-
rules: {
|
|
19
|
-
'react/react-in-jsx-scope': 'off',
|
|
20
|
-
'react/prop-types': 'off',
|
|
21
|
-
},
|
|
22
|
-
env: {
|
|
23
|
-
browser: true,
|
|
24
|
-
es2021: true,
|
|
25
|
-
},
|
|
26
|
-
settings: {
|
|
27
|
-
'import/resolver': {
|
|
28
|
-
typescript: {},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|