@vtx/player 0.0.5 → 0.0.8

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.
@@ -1,37 +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;
22
- }
23
- export declare type ChannelType = {
24
- /** 通道号 */
25
- channelNum: string;
26
- /** 设备ID */
27
- deviceId?: string;
28
- /** 租户ID */
29
- tenantId?: string;
30
- /** 协议 */
31
- protocol?: string;
32
- };
33
- /**
34
- * 实时分屏组件
35
- */
36
- declare const LiveControl: import("react").ForwardRefExoticComponent<LiveControlProps & import("react").RefAttributes<LiveControlHandle>>;
37
- export default LiveControl;
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;
@@ -1,22 +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;
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;
@@ -1,84 +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;
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;
@@ -1,8 +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;
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;
@@ -1,9 +1,9 @@
1
- /**
2
- * 获取配置信息
3
- * @returns
4
- */
5
- declare const useSettings: () => {
6
- theme: "light" | "dark";
7
- isDark: boolean;
8
- };
9
- export default useSettings;
1
+ /**
2
+ * 获取配置信息
3
+ * @returns
4
+ */
5
+ declare const useSettings: () => {
6
+ theme: "light" | "dark";
7
+ isDark: boolean;
8
+ };
9
+ export default useSettings;
@@ -1,54 +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
+ 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,8 +1,8 @@
1
- import 'antd/dist/antd.css';
2
- export { default as Player } from './components/player';
3
- export { default as LivePlayer } from './components/live-player';
4
- export { default as HistoryPlayer } from './components/history-player';
5
- export { default as LiveControl } from './components/live-control';
6
- export { default as HistoryControl } from './components/history-control';
7
- export { default as BillPlayer } from './components/bill-player';
8
- export { default as LiveChannelPlayer } from './components/live-channel-player';
1
+ import 'antd/dist/antd.css';
2
+ export { default as Player } from './components/player';
3
+ export { default as LivePlayer } from './components/live-player';
4
+ export { default as HistoryPlayer } from './components/history-player';
5
+ export { default as LiveControl } from './components/live-control';
6
+ export { default as HistoryControl } from './components/history-control';
7
+ export { default as BillPlayer } from './components/bill-player';
8
+ export { default as LiveChannelPlayer } from './components/live-channel-player';
@@ -1,60 +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
- export {};
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 {};