@vtx/player 0.0.6 → 0.0.9

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.
Files changed (89) hide show
  1. package/dist/index.d.ts +221 -0
  2. package/dist/index.es.js +533 -0
  3. package/dist/index.es.js.map +1 -0
  4. package/dist/index.umd.js +533 -0
  5. package/dist/index.umd.js.map +1 -0
  6. package/dist/types/api/fetch.d.ts +12 -0
  7. package/dist/types/api/index.d.ts +15 -0
  8. package/{src/api/types.ts → dist/types/api/types.d.ts} +5 -29
  9. package/dist/types/components/bill-player/index.d.ts +21 -0
  10. package/dist/types/components/controls/index.d.ts +52 -0
  11. package/dist/types/components/history-control/index.d.ts +39 -0
  12. package/dist/types/components/history-player/index.d.ts +31 -0
  13. package/dist/types/components/live-channel-player/index.d.ts +16 -0
  14. package/dist/types/components/live-control/index.d.ts +35 -0
  15. package/dist/types/components/live-player/index.d.ts +22 -0
  16. package/dist/types/components/player/index.d.ts +84 -0
  17. package/dist/types/context/index.d.ts +8 -0
  18. package/dist/types/hooks/useSettings.d.ts +9 -0
  19. package/dist/types/icons/index.d.ts +54 -0
  20. package/{src/main.ts → dist/types/main.d.ts} +0 -1
  21. package/dist/types/utils/index.d.ts +67 -0
  22. package/package.json +4 -2
  23. package/.eslintignore +0 -11
  24. package/.eslintrc.js +0 -31
  25. package/.prettierignore +0 -10
  26. package/.prettierrc.js +0 -22
  27. package/.storybook/main.js +0 -58
  28. package/.storybook/manager.js +0 -7
  29. package/.storybook/preview-head.html +0 -5
  30. package/.storybook/preview.js +0 -9
  31. package/.storybook/proxy.js +0 -6
  32. package/.storybook/theme.js +0 -8
  33. package/.stylelintrc.json +0 -13
  34. package/.vscode/extensions.json +0 -10
  35. package/.vscode/settings.json +0 -16
  36. package/commitlint.config.js +0 -10
  37. package/public/h5player.min.js +0 -311
  38. package/public/playctrl1/AudioRenderer.js +0 -225
  39. package/public/playctrl1/DecodeWorker.js +0 -711
  40. package/public/playctrl1/Decoder.js +0 -1
  41. package/public/playctrl1/SuperRender_10.js +0 -396
  42. package/public/playctrl2/Decoder.js +0 -21
  43. package/public/playctrl2/Decoder.wasm +0 -0
  44. package/public/playctrl2/Decoder.worker.js +0 -1
  45. package/public/playctrl3/Decoder.js +0 -21
  46. package/public/playctrl3/Decoder.wasm +0 -0
  47. package/public/playctrl3/Decoder.worker.js +0 -1
  48. package/rollup.config.js +0 -52
  49. package/src/api/fetch.ts +0 -55
  50. package/src/api/index.ts +0 -43
  51. package/src/components/bill-player/index.less +0 -58
  52. package/src/components/bill-player/index.stories.mdx +0 -24
  53. package/src/components/bill-player/index.stories.tsx +0 -13
  54. package/src/components/bill-player/index.tsx +0 -267
  55. package/src/components/controls/images/arrow.png +0 -0
  56. package/src/components/controls/images/error.png +0 -0
  57. package/src/components/controls/index.less +0 -182
  58. package/src/components/controls/index.tsx +0 -312
  59. package/src/components/history-control/images/collapse.png +0 -0
  60. package/src/components/history-control/index.less +0 -211
  61. package/src/components/history-control/index.stories.mdx +0 -62
  62. package/src/components/history-control/index.stories.tsx +0 -130
  63. package/src/components/history-control/index.tsx +0 -368
  64. package/src/components/history-player/index.less +0 -98
  65. package/src/components/history-player/index.stories.mdx +0 -38
  66. package/src/components/history-player/index.stories.tsx +0 -12
  67. package/src/components/history-player/index.tsx +0 -206
  68. package/src/components/live-channel-player/index.stories.mdx +0 -29
  69. package/src/components/live-channel-player/index.stories.tsx +0 -11
  70. package/src/components/live-channel-player/index.tsx +0 -75
  71. package/src/components/live-control/index.less +0 -65
  72. package/src/components/live-control/index.stories.mdx +0 -64
  73. package/src/components/live-control/index.stories.tsx +0 -61
  74. package/src/components/live-control/index.tsx +0 -274
  75. package/src/components/live-player/index.less +0 -71
  76. package/src/components/live-player/index.stories.mdx +0 -35
  77. package/src/components/live-player/index.stories.tsx +0 -12
  78. package/src/components/live-player/index.tsx +0 -118
  79. package/src/components/player/index.ts +0 -318
  80. package/src/context/index.ts +0 -13
  81. package/src/hooks/useSettings.tsx +0 -14
  82. package/src/icons/index.less +0 -27
  83. package/src/icons/index.tsx +0 -518
  84. package/src/stories/intro.stories.mdx +0 -16
  85. package/src/typings/@vtx/utils/index.d.ts +0 -27
  86. package/src/typings/h5player.d.ts +0 -133
  87. package/src/utils/index.ts +0 -215
  88. package/src/vite-env.d.ts +0 -1
  89. 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,15 @@
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
+ * @returns
14
+ */
15
+ export declare const loadVideoChannel: (channelId: string) => Promise<Types.LoadVideoChannelResp>;
@@ -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
  /** 频道号 */
@@ -29,7 +28,6 @@ export interface GetPreviewUrlParams {
29
28
  /** 协议 */
30
29
  protocol?: string;
31
30
  }
32
-
33
31
  /** 历史地址子项 */
34
32
  export interface HistoryUrlItem {
35
33
  /** 开始时间 */
@@ -41,7 +39,6 @@ export interface HistoryUrlItem {
41
39
  /** 大小 */
42
40
  size: number;
43
41
  }
44
-
45
42
  /** 获取历史地址Resp */
46
43
  export interface GetHistoryUrlResp {
47
44
  /** 设备名称 */
@@ -57,7 +54,6 @@ export interface GetHistoryUrlResp {
57
54
  /** 地址 */
58
55
  url: string;
59
56
  }
60
-
61
57
  /** 获取历史地址Params */
62
58
  export interface GetHistoryUrlParams {
63
59
  /** 频道号 */
@@ -71,13 +67,11 @@ export interface GetHistoryUrlParams {
71
67
  /** 结束时间,格式:2022-06-01 23:59:59 */
72
68
  endTime: string;
73
69
  }
74
-
75
70
  /** 获取视频信息Params */
76
71
  export interface LoadVideoInfoParams {
77
72
  /** 业务ID */
78
73
  billId: string;
79
74
  }
80
-
81
75
  export interface LoadVideoInfo {
82
76
  /** 频道号 */
83
77
  channelNum: string;
@@ -87,10 +81,9 @@ export interface LoadVideoInfo {
87
81
  channelName: string;
88
82
  }
89
83
  /** 获取视频信息Resp */
90
- export type LoadVideoInfoResp = LoadVideoInfo[];
91
-
84
+ export declare type LoadVideoInfoResp = LoadVideoInfo[];
92
85
  /** 云台控制Params */
93
- export type CloudControlParams = {
86
+ export declare type CloudControlParams = {
94
87
  /** 频道号 */
95
88
  channelNum: string;
96
89
  /** 设备ID */
@@ -100,30 +93,13 @@ export type CloudControlParams = {
100
93
  /** 命令 */
101
94
  command: CloudControlCommandType;
102
95
  };
103
-
104
96
  /** 云台控制命令 */
105
- export type CloudControlCommandType =
106
- | 'LEFT'
107
- | 'RIGHT'
108
- | 'UP'
109
- | 'DOWN'
110
- | 'LEFT_UP'
111
- | 'LEFT_DOWN'
112
- | 'RIGHT_UP'
113
- | 'RIGHT_DOWN'
114
- | 'ZOOM_IN'
115
- | 'ZOOM_OUT'
116
- | 'FOCUS_NEAR'
117
- | 'FOCUS_FAR'
118
- | 'IRIS_ENLARGE'
119
- | 'IRIS_REDUCE';
120
-
121
- export type LoadVideoChannelParams = {
97
+ 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';
98
+ export declare type LoadVideoChannelParams = {
122
99
  /** 通道ID */
123
100
  videoChannelId: string;
124
101
  };
125
-
126
- export type LoadVideoChannelResp = {
102
+ export declare type LoadVideoChannelResp = {
127
103
  /** 通道号 */
128
104
  channelNum: string;
129
105
  /** 设备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 | 4 | 8;
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 speed:播放速率 */
28
+ onTimeChange?: (time: string, speed: number) => void;
29
+ }
30
+ export declare const HistoryPlayer: import("react").ForwardRefExoticComponent<VtxPlayerProps & import("react").RefAttributes<HistoryPlayerHandle>>;
31
+ export default HistoryPlayer;
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ interface LiveChannelPlayerProps {
3
+ /** 通道ID */
4
+ channelId: string;
5
+ /** 宽度 */
6
+ width?: number;
7
+ /** 高度 */
8
+ height?: number;
9
+ }
10
+ /**
11
+ * 基于通道ID的实时播放器
12
+ * @param props
13
+ * @returns
14
+ */
15
+ export declare const LiveChannelPlayer: (props: LiveChannelPlayerProps) => JSX.Element | undefined;
16
+ 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
+ polling?: number | undefined;
22
+ }
23
+ export declare type ChannelType = {
24
+ /** 通道号 */
25
+ channelNum: string;
26
+ /** 设备ID */
27
+ deviceId?: 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 | 4 | 8): void;
56
+ /**
57
+ * 时间更新事件
58
+ * @param callback 回调函数
59
+ */
60
+ onTimeUpdate(callback: (currentTime: number, speed: 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,8 @@
1
+ import React from 'react';
2
+ export declare const PlayerThemeContext: React.Context<Context>;
3
+ interface Context {
4
+ /** 主题 */
5
+ theme: 'light' | 'dark';
6
+ }
7
+ declare const PlayerThemeProvider: React.Provider<Context>;
8
+ export default PlayerThemeProvider;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 获取配置信息
3
+ * @returns
4
+ */
5
+ declare const useSettings: () => {
6
+ theme: "light" | "dark";
7
+ isDark: boolean;
8
+ };
9
+ export default useSettings;
@@ -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 {};
@@ -1,5 +1,4 @@
1
1
  import 'antd/dist/antd.css';
2
-
3
2
  export { default as Player } from './components/player';
4
3
  export { default as LivePlayer } from './components/live-player';
5
4
  export { default as HistoryPlayer } from './components/history-player';
@@ -0,0 +1,67 @@
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
+ /**
61
+ * 获取地址栏中的参数信息
62
+ * @param key 字段key
63
+ * @param href 链接
64
+ * @returns 字段值
65
+ */
66
+ export declare const getUrlParam: (key?: string, href?: string) => any;
67
+ export {};
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@vtx/player",
3
- "version": "0.0.6",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "description": "视频业务组件",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",
8
8
  "types": "./dist/index.d.ts",
9
- "file": "dist",
9
+ "files": [
10
+ "dist"
11
+ ],
10
12
  "scripts": {
11
13
  "start": "start-storybook -p 6006",
12
14
  "build": "npm run clean && rollup --config",
package/.eslintignore DELETED
@@ -1,11 +0,0 @@
1
- dist
2
- node_modules
3
- .cache
4
- *.lock
5
- .gitignore
6
- .npmignore
7
- .prettierignore
8
- *.snap
9
- .gitlab-ci.yml
10
- storybook-static
11
- *.js
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
- };
package/.prettierignore DELETED
@@ -1,10 +0,0 @@
1
- dist
2
- node_modules
3
- .cache
4
- *.lock
5
- .gitignore
6
- .npmignore
7
- .prettierignore
8
- *.snap
9
- .gitlab-ci.yml
10
- storybook-static
package/.prettierrc.js DELETED
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- // 一行最多 100 字符
3
- printWidth: 100,
4
- // 使用4个空格缩进
5
- tabWidth: 4,
6
- // 使用单引号
7
- singleQuote: true,
8
- // 复写样式
9
- overrides: [
10
- {
11
- files: ['vite.config.ts', '*.js', '*.json'],
12
- options: {
13
- tabWidth: 2,
14
- },
15
- },
16
- ],
17
- /** import顺序 */
18
- importOrder: ['index.less', '^react(.*)$', '^(?!(@/|./))(.*)$', '^@/(.*)$', '^[./]'],
19
- /** import后添加分号 */
20
- importOrderSeparation: true,
21
- importOrderSortSpecifiers: true,
22
- };