@vtx/player 0.0.1 → 0.0.4
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/dist/index.d.ts +225 -0
- package/dist/index.es.js +533 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +533 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/types/api/fetch.d.ts +12 -0
- package/dist/types/api/index.d.ts +16 -0
- package/{src/api/types.ts → dist/types/api/types.d.ts} +7 -31
- package/dist/types/components/bill-player/index.d.ts +21 -0
- package/dist/types/components/controls/index.d.ts +52 -0
- package/dist/types/components/history-control/index.d.ts +39 -0
- package/dist/types/components/history-player/index.d.ts +31 -0
- package/dist/types/components/live-channel-player/index.d.ts +18 -0
- package/dist/types/components/live-control/index.d.ts +37 -0
- package/dist/types/components/live-player/index.d.ts +22 -0
- package/dist/types/components/player/index.d.ts +84 -0
- package/dist/types/context/index.d.ts +8 -0
- package/dist/types/hooks/useSettings.d.ts +9 -0
- package/dist/types/icons/index.d.ts +54 -0
- package/{src/main.ts → dist/types/main.d.ts} +0 -1
- package/dist/types/utils/index.d.ts +60 -0
- package/package.json +4 -2
- 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
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}JSPlayerModule(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{Module["__emscripten_thread_exit"](-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}postMessage({"cmd":"cancelDone"})}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
package/rollup.config.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import babel from '@rollup/plugin-babel';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
4
|
-
import typescript from '@rollup/plugin-typescript';
|
|
5
|
-
import url from '@rollup/plugin-url';
|
|
6
|
-
import dts from 'rollup-plugin-dts';
|
|
7
|
-
import external from 'rollup-plugin-peer-deps-external';
|
|
8
|
-
import postcss from 'rollup-plugin-postcss';
|
|
9
|
-
import { terser } from 'rollup-plugin-terser';
|
|
10
|
-
|
|
11
|
-
const packageJson = require('./package.json');
|
|
12
|
-
|
|
13
|
-
export default [
|
|
14
|
-
{
|
|
15
|
-
input: 'src/main.ts',
|
|
16
|
-
output: [
|
|
17
|
-
// 构建cjs格式包
|
|
18
|
-
{
|
|
19
|
-
file: packageJson.main,
|
|
20
|
-
format: 'cjs',
|
|
21
|
-
sourcemap: true,
|
|
22
|
-
},
|
|
23
|
-
// 构建esm格式包
|
|
24
|
-
{
|
|
25
|
-
file: packageJson.module,
|
|
26
|
-
format: 'esm',
|
|
27
|
-
sourcemap: true,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
plugins: [
|
|
31
|
-
external(), // 排除peerDependencies中的包不被压缩到输出文件中
|
|
32
|
-
resolve(), // 添加rollup引用第三方包支持
|
|
33
|
-
babel({
|
|
34
|
-
exclude: 'node_modules/**',
|
|
35
|
-
presets: [['@babel/preset-env']],
|
|
36
|
-
babelHelpers: 'bundled',
|
|
37
|
-
}),
|
|
38
|
-
commonjs(), // 添加commonJs支持
|
|
39
|
-
postcss(), // 处理css文件
|
|
40
|
-
url(), // 处理图片文件
|
|
41
|
-
typescript({ tsconfig: './tsconfig.json' }), //处理 typescript文件
|
|
42
|
-
terser(), // 文件压缩
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
// 打包d.ts文件
|
|
47
|
-
input: 'dist/types/main.d.ts',
|
|
48
|
-
output: [{ file: packageJson.types, format: 'esm' }],
|
|
49
|
-
external: [/\.less$/],
|
|
50
|
-
plugins: [dts()],
|
|
51
|
-
},
|
|
52
|
-
];
|
package/src/api/fetch.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
interface VMFetchProps {
|
|
2
|
-
/** 请求体 */
|
|
3
|
-
data?: any;
|
|
4
|
-
/** 请求头 */
|
|
5
|
-
headersEx?: object;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 数据fetch总入口
|
|
10
|
-
* @param props
|
|
11
|
-
*/
|
|
12
|
-
const Fetch = async <T>(
|
|
13
|
-
url: string,
|
|
14
|
-
type: 'GET' | 'POST' = 'GET',
|
|
15
|
-
params?: VMFetchProps
|
|
16
|
-
): Promise<T> => {
|
|
17
|
-
const { data, headersEx } = params || {};
|
|
18
|
-
try {
|
|
19
|
-
let headers: HeadersInit = { 'content-type': 'application/json' };
|
|
20
|
-
if (headersEx) {
|
|
21
|
-
headers = { ...headers, ...headersEx };
|
|
22
|
-
}
|
|
23
|
-
if (type === 'GET' && data) {
|
|
24
|
-
const queryString = Object.keys(data)
|
|
25
|
-
.map((key) => key + '=' + data[key])
|
|
26
|
-
.join('&');
|
|
27
|
-
|
|
28
|
-
url += '?' + queryString;
|
|
29
|
-
}
|
|
30
|
-
const resp = await fetch(encodeURI(url), {
|
|
31
|
-
body: type === 'POST' ? JSON.stringify(data) : undefined,
|
|
32
|
-
headers,
|
|
33
|
-
method: type,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const json: Result<T> = await resp.json();
|
|
37
|
-
if (json.result === 0) return json.data;
|
|
38
|
-
else {
|
|
39
|
-
const error = {
|
|
40
|
-
exception: json.exception,
|
|
41
|
-
msg: json.msg,
|
|
42
|
-
};
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
} catch (e) {
|
|
46
|
-
return Promise.reject(e);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export default Fetch;
|
package/src/api/index.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import Fetch from './fetch';
|
|
2
|
-
import * as Types from './types';
|
|
3
|
-
|
|
4
|
-
/** 获取预览地址 */
|
|
5
|
-
export const getPreviewUrl = (data: Types.GetPreviewUrlParams) =>
|
|
6
|
-
Fetch<Types.GetPreviewUrlResp>('/cloud/vis/base/np/artemis/previewUrl.smvc', 'GET', {
|
|
7
|
-
data,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
/** 获取历史地址 */
|
|
11
|
-
export const getHistoryUrl = (data: Types.GetHistoryUrlParams) =>
|
|
12
|
-
Fetch<Types.GetHistoryUrlResp>('/cloud/vis/base/np/artemis/playbackUrl.smvc', 'GET', {
|
|
13
|
-
data,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
/** 获取视频信息 */
|
|
17
|
-
export const loadVideoInfo = (data: Types.LoadVideoInfoParams) =>
|
|
18
|
-
Fetch<Types.LoadVideoInfoResp>('/cloud/vis/base/np/videoCommon/loadVideoInfos.smvc', 'GET', {
|
|
19
|
-
data,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
/** 云台控制 */
|
|
23
|
-
export const cloudControl = (data: Types.CloudControlParams) =>
|
|
24
|
-
Fetch('/cloud/vis/base/np/artemis/controlling.smvc', 'GET', {
|
|
25
|
-
data,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 获取通道信息
|
|
30
|
-
* @param channelId 通道ID
|
|
31
|
-
* @param tenantId 租户ID
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
export const loadVideoChannel = async (channelId: string, tenantId: string) => {
|
|
35
|
-
const result = await Fetch<string>(
|
|
36
|
-
'/cloud/vis/base/np/videoDevice/loadTheVideoChannel.smvc',
|
|
37
|
-
'GET',
|
|
38
|
-
{
|
|
39
|
-
data: { parameters: JSON.stringify({ videoChannelId: channelId, tenantId }) },
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
const parseResult = JSON.parse(result) as Types.LoadVideoChannelResp[];
|
|
43
|
-
return parseResult[0];
|
|
44
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
.vtx-bill-player {
|
|
2
|
-
.bill-tabs {
|
|
3
|
-
height: 100%;
|
|
4
|
-
|
|
5
|
-
.ant-tabs-content-holder {
|
|
6
|
-
height: 100%;
|
|
7
|
-
|
|
8
|
-
.ant-tabs-content {
|
|
9
|
-
height: 100%;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.player-panel {
|
|
15
|
-
display: flex;
|
|
16
|
-
height: 100%;
|
|
17
|
-
|
|
18
|
-
> .player-container {
|
|
19
|
-
flex-grow: 1;
|
|
20
|
-
width: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.control-container {
|
|
24
|
-
width: 376px;
|
|
25
|
-
height: fit-content;
|
|
26
|
-
margin-left: 16px;
|
|
27
|
-
border: 1px solid #e8e8e8;
|
|
28
|
-
border-radius: 2px;
|
|
29
|
-
|
|
30
|
-
.header {
|
|
31
|
-
padding: 12px 24px;
|
|
32
|
-
font-weight: bold;
|
|
33
|
-
border-bottom: 1px solid #e8e8e8;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.list {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
padding: 12px 24px;
|
|
40
|
-
|
|
41
|
-
.ant-checkbox-wrapper {
|
|
42
|
-
margin-bottom: 12px;
|
|
43
|
-
margin-left: 0;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.form {
|
|
48
|
-
padding: 12px 24px;
|
|
49
|
-
|
|
50
|
-
.time-radio-group {
|
|
51
|
-
.ant-radio-wrapper {
|
|
52
|
-
margin-right: 4px;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import BillPlayer from '.';
|
|
2
|
-
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
3
|
-
|
|
4
|
-
import * as stories from './index.stories';
|
|
5
|
-
|
|
6
|
-
<Meta title="组件/业务播放器" component={BillPlayer} />
|
|
7
|
-
|
|
8
|
-
# 组件--按钮
|
|
9
|
-
|
|
10
|
-
### 如何使用
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
import { BillPlayer } from '@vtx/player';
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### 属性
|
|
17
|
-
|
|
18
|
-
<ArgsTable of={BillPlayer} />
|
|
19
|
-
|
|
20
|
-
### 例子
|
|
21
|
-
|
|
22
|
-
<Canvas>
|
|
23
|
-
<Story name="业务播放器" story={stories.Default} />
|
|
24
|
-
</Canvas>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import BillPlayer from '.';
|
|
2
|
-
import { ComponentStory } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
const Template: ComponentStory<typeof BillPlayer> = (args) => <BillPlayer {...args} />;
|
|
5
|
-
export const Default = Template.bind({});
|
|
6
|
-
Default.args = {
|
|
7
|
-
width: 1200,
|
|
8
|
-
height: 600,
|
|
9
|
-
params: {
|
|
10
|
-
tenantId: '60edef2faea44a39a6385146f4fa131c',
|
|
11
|
-
billId: 'shxq_qqq',
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
export default Template;
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
|
2
|
-
|
|
3
|
-
import { useRef } from 'react';
|
|
4
|
-
|
|
5
|
-
import HistoryControl, { HistoryControlHandle } from '../history-control';
|
|
6
|
-
import LiveControl, { LiveControlHandle } from '../live-control';
|
|
7
|
-
import { useRequest, useSetState } from 'ahooks';
|
|
8
|
-
import { Button, Checkbox, DatePicker, Form, Radio, RadioChangeEvent, Select, Tabs } from 'antd';
|
|
9
|
-
import moment from 'moment';
|
|
10
|
-
|
|
11
|
-
import { loadVideoInfo } from '@/api';
|
|
12
|
-
import { LoadVideoInfoParams } from '@/api/types';
|
|
13
|
-
import { TimeFormat } from '@/utils';
|
|
14
|
-
|
|
15
|
-
const { TabPane } = Tabs;
|
|
16
|
-
|
|
17
|
-
type HistoryFormData = {
|
|
18
|
-
/** 频道号 */
|
|
19
|
-
channelNum: string;
|
|
20
|
-
/** 开始时间,格式:2022-06-01 00:00:00 */
|
|
21
|
-
beginTime: string;
|
|
22
|
-
/** 结束时间,格式:2022-06-01 23:59:59 */
|
|
23
|
-
endTime: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
interface State {
|
|
27
|
-
/** 日期选择器是否可用 */
|
|
28
|
-
datePickerDisabled: boolean;
|
|
29
|
-
/** 实时视频列表勾选状态 */
|
|
30
|
-
liveListState: Map<string, boolean>;
|
|
31
|
-
/** 设备ID */
|
|
32
|
-
deviceId: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface BillPlayerProps {
|
|
36
|
-
/** 参数 */
|
|
37
|
-
params: LoadVideoInfoParams;
|
|
38
|
-
/** 宽度 */
|
|
39
|
-
width?: string | number;
|
|
40
|
-
/** 高度 */
|
|
41
|
-
height?: string | number;
|
|
42
|
-
/** 是否显示实时视频,默认为true */
|
|
43
|
-
live?: boolean;
|
|
44
|
-
/** 是否显示历史视频,默认为true */
|
|
45
|
-
history?: boolean;
|
|
46
|
-
/** 实时默认播放 */
|
|
47
|
-
defaultLivePlay?: boolean;
|
|
48
|
-
/** 历史默认播放 */
|
|
49
|
-
defaultHistoryPlay?: boolean;
|
|
50
|
-
}
|
|
51
|
-
export const BillPlayer = (props: BillPlayerProps) => {
|
|
52
|
-
const {
|
|
53
|
-
params,
|
|
54
|
-
live = true,
|
|
55
|
-
history = true,
|
|
56
|
-
height = '100%',
|
|
57
|
-
width = '100%',
|
|
58
|
-
defaultLivePlay = true,
|
|
59
|
-
} = props;
|
|
60
|
-
const [state, setState] = useSetState<State>({
|
|
61
|
-
datePickerDisabled: false,
|
|
62
|
-
liveListState: new Map(),
|
|
63
|
-
deviceId: '',
|
|
64
|
-
});
|
|
65
|
-
const { data } = useRequest(() => loadVideoInfo(params), {
|
|
66
|
-
refreshDeps: [params.billId],
|
|
67
|
-
onSuccess: (result) => {
|
|
68
|
-
if (defaultLivePlay) {
|
|
69
|
-
const livePlayer = liveRef.current;
|
|
70
|
-
if (livePlayer) {
|
|
71
|
-
const liveListState = new Map();
|
|
72
|
-
for (const item of result) {
|
|
73
|
-
liveListState.set(item.channelNum, true);
|
|
74
|
-
}
|
|
75
|
-
setState({ liveListState, deviceId: result[0].videoDeviceId });
|
|
76
|
-
livePlayer.multiLoad(
|
|
77
|
-
result.map((item) => ({
|
|
78
|
-
channelNum: item.channelNum,
|
|
79
|
-
deviceId: item.videoDeviceId,
|
|
80
|
-
tenantId: params.tenantId,
|
|
81
|
-
}))
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
form.setFieldsValue({ channelNum: result[0].channelNum });
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
const [form] = Form.useForm();
|
|
89
|
-
const liveRef = useRef<LiveControlHandle>(null);
|
|
90
|
-
const historyRef = useRef<HistoryControlHandle>(null);
|
|
91
|
-
const getLivePanel = () => {
|
|
92
|
-
const list = data?.map((item) => (
|
|
93
|
-
<Checkbox
|
|
94
|
-
key={item.channelNum}
|
|
95
|
-
checked={state.liveListState.get(item.channelNum)}
|
|
96
|
-
onChange={(e) => {
|
|
97
|
-
const checked = e.target.checked;
|
|
98
|
-
const liveControl = liveRef.current;
|
|
99
|
-
if (liveControl) {
|
|
100
|
-
if (checked) {
|
|
101
|
-
liveControl.load({ ...item, deviceId: item.videoDeviceId });
|
|
102
|
-
} else {
|
|
103
|
-
liveControl.unLoad(item.channelNum);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}}
|
|
107
|
-
>
|
|
108
|
-
{item.channelName}
|
|
109
|
-
</Checkbox>
|
|
110
|
-
));
|
|
111
|
-
return (
|
|
112
|
-
<div className="player-panel">
|
|
113
|
-
<div className="player-container">
|
|
114
|
-
<LiveControl
|
|
115
|
-
ref={liveRef}
|
|
116
|
-
onChannelChange={(channelsNum) => {
|
|
117
|
-
const liveListState = new Map(state.liveListState);
|
|
118
|
-
for (const channelNum of channelsNum) {
|
|
119
|
-
liveListState.set(channelNum, !liveListState.get(channelNum));
|
|
120
|
-
}
|
|
121
|
-
for (const item of liveListState) {
|
|
122
|
-
if (channelsNum.includes(item[0])) liveListState.set(item[0], true);
|
|
123
|
-
else liveListState.set(item[0], false);
|
|
124
|
-
}
|
|
125
|
-
setState({ liveListState });
|
|
126
|
-
}}
|
|
127
|
-
/>
|
|
128
|
-
</div>
|
|
129
|
-
<div className="control-container">
|
|
130
|
-
<div className="header">视频通道</div>
|
|
131
|
-
<div className="list">{list}</div>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
const onHistorySubmit = (values: HistoryFormData) => {
|
|
137
|
-
const historyControl = historyRef.current;
|
|
138
|
-
historyControl?.load({
|
|
139
|
-
channelNum: values.channelNum,
|
|
140
|
-
tenantId: params.tenantId,
|
|
141
|
-
deviceId: state.deviceId,
|
|
142
|
-
beginTime: moment(values.beginTime).format(TimeFormat.default),
|
|
143
|
-
endTime: moment(values.endTime).format(TimeFormat.default),
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
const onTimeRadioChange = (e: RadioChangeEvent) => {
|
|
147
|
-
const value = e.target.value;
|
|
148
|
-
if (value === 'custom') {
|
|
149
|
-
setState({ datePickerDisabled: false });
|
|
150
|
-
} else {
|
|
151
|
-
setState({ datePickerDisabled: true });
|
|
152
|
-
if (value === 'today') {
|
|
153
|
-
form.setFieldsValue({
|
|
154
|
-
beginTime: moment().startOf('day'),
|
|
155
|
-
endTime: moment(),
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (value === 'yesterday') {
|
|
159
|
-
form.setFieldsValue({
|
|
160
|
-
beginTime: moment().subtract(1, 'day').startOf('day'),
|
|
161
|
-
endTime: moment().subtract(1, 'day').endOf('day'),
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
if (value === 'dayBeforeYesterday') {
|
|
165
|
-
form.setFieldsValue({
|
|
166
|
-
beginTime: moment().subtract(2, 'day').startOf('day'),
|
|
167
|
-
endTime: moment().subtract(2, 'day').endOf('day'),
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
const getHistoryPanel = () => {
|
|
173
|
-
return (
|
|
174
|
-
<div className="player-panel">
|
|
175
|
-
<div className="player-container">
|
|
176
|
-
<HistoryControl ref={historyRef} />
|
|
177
|
-
</div>
|
|
178
|
-
<div className="control-container">
|
|
179
|
-
<div className="header">查询视频</div>
|
|
180
|
-
<div className="form">
|
|
181
|
-
<Form
|
|
182
|
-
form={form}
|
|
183
|
-
name="history"
|
|
184
|
-
labelCol={{ span: 5 }}
|
|
185
|
-
wrapperCol={{ span: 19 }}
|
|
186
|
-
onFinish={onHistorySubmit}
|
|
187
|
-
requiredMark={false}
|
|
188
|
-
colon={false}
|
|
189
|
-
initialValues={{
|
|
190
|
-
beginTime: moment().subtract(1, 'day').startOf('day'),
|
|
191
|
-
endTime: moment().subtract(1, 'day').endOf('day'),
|
|
192
|
-
}}
|
|
193
|
-
autoComplete="off"
|
|
194
|
-
>
|
|
195
|
-
<Form.Item label="选择时段">
|
|
196
|
-
<Radio.Group
|
|
197
|
-
onChange={onTimeRadioChange}
|
|
198
|
-
defaultValue="custom"
|
|
199
|
-
className="time-radio-group"
|
|
200
|
-
>
|
|
201
|
-
<Radio value="today">当日</Radio>
|
|
202
|
-
<Radio value="yesterday">昨日</Radio>
|
|
203
|
-
<Radio value="dayBeforeYesterday">前日</Radio>
|
|
204
|
-
<Radio value="custom">自选</Radio>
|
|
205
|
-
</Radio.Group>
|
|
206
|
-
</Form.Item>
|
|
207
|
-
<Form.Item
|
|
208
|
-
label="开始时间"
|
|
209
|
-
name="beginTime"
|
|
210
|
-
rules={[{ required: true, message: '请输入开始时间' }]}
|
|
211
|
-
>
|
|
212
|
-
<DatePicker
|
|
213
|
-
style={{ width: '100%' }}
|
|
214
|
-
showTime
|
|
215
|
-
disabled={state.datePickerDisabled}
|
|
216
|
-
/>
|
|
217
|
-
</Form.Item>
|
|
218
|
-
<Form.Item
|
|
219
|
-
label="结束时间"
|
|
220
|
-
name="endTime"
|
|
221
|
-
rules={[{ required: true, message: '请输入结束时间' }]}
|
|
222
|
-
>
|
|
223
|
-
<DatePicker showTime disabled={state.datePickerDisabled} />
|
|
224
|
-
</Form.Item>
|
|
225
|
-
<Form.Item
|
|
226
|
-
label="视频通道"
|
|
227
|
-
name="channelNum"
|
|
228
|
-
rules={[{ required: true, message: '请选择视频通道' }]}
|
|
229
|
-
>
|
|
230
|
-
<Select>
|
|
231
|
-
{data?.map((item) => (
|
|
232
|
-
<Select.Option
|
|
233
|
-
key={item.channelNum}
|
|
234
|
-
value={item.channelNum}
|
|
235
|
-
>
|
|
236
|
-
{item.channelName}
|
|
237
|
-
</Select.Option>
|
|
238
|
-
))}
|
|
239
|
-
</Select>
|
|
240
|
-
</Form.Item>
|
|
241
|
-
<Form.Item wrapperCol={{ span: 24 }}>
|
|
242
|
-
<Button type="primary" htmlType="submit">
|
|
243
|
-
查询
|
|
244
|
-
</Button>
|
|
245
|
-
</Form.Item>
|
|
246
|
-
</Form>
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
</div>
|
|
250
|
-
);
|
|
251
|
-
};
|
|
252
|
-
return (
|
|
253
|
-
<div className="vtx-bill-player" style={{ height, width }}>
|
|
254
|
-
{live && history && (
|
|
255
|
-
<Tabs defaultActiveKey="live" className="bill-tabs">
|
|
256
|
-
<TabPane tab="实时视频" key="live">
|
|
257
|
-
{getLivePanel()}
|
|
258
|
-
</TabPane>
|
|
259
|
-
<TabPane tab="历史视频" key="history">
|
|
260
|
-
{getHistoryPanel()}
|
|
261
|
-
</TabPane>
|
|
262
|
-
</Tabs>
|
|
263
|
-
)}
|
|
264
|
-
{live && !history && getLivePanel()}
|
|
265
|
-
{history && !live && getHistoryPanel()}
|
|
266
|
-
</div>
|
|
267
|
-
);
|
|
268
|
-
};
|
|
269
|
-
export default BillPlayer;
|
|
Binary file
|
|
Binary file
|