1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/*
* @Author: 634665781 634665781@qq.com
* @Date: 2023-04-11 13:40:18
* @LastEditors: Please set LastEditors
* @LastEditTime: 2025-03-17 15:30:02
* @FilePath: \wisdom-components\packages\base-components\VmsVideo\src\demos\dmeo1.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// @ts-ignore
import React, { useRef, useEffect } from 'react';
import Video from '../index';
const Demo1 = (props) => {
const jessibuca = useRef(null);
let JessibucaObj = {
operateBtns: {
// fullscreen: false,
screenshot: false,
},
loadingText: '演示视频加载中',
decoder: '/JessibucaVideo/decoder.js',
};
// 若是在子应用中,则需加上子应用名称,且兼容基座
// 如下:
// let _url = '/civ_energy/JessibucaVideo/decoder.js'
// let JessibucaObj = {
// decoder: window.__POWERED_BY_QIANKUN__ ? '/civbase' + _url : _url
// }
// let VideoInfo = {
// key: '123638446', //'1CEB209F-8BC7-44B5-9F6B-3D8FCB855E76',
// dataRate: `/2`,
// fullUrl: 'ws://172.16.19.19:8080/jessica/1CEB209F-8BC7-44B5-9F6B-3D8FCB855E76',
// useFullUrl: true,
// cameraName: `摄像头s8`,
// appKey: '6c44c8e92d1c4d75a9818756025df550',
// appSecret: '78b7dc88f9f4bf19c2b1aabfdd995244',
// protocol: '萤石EZOPEN',
//};
let VideoParam = {
id: '30E1F9B0-78C2-4947-9C9A-43C86A6678D4',
name: '武汉测试',
protocol: '萤石云HTTP-FLV',
username: '6c44c8e92d1c4d75a9818756025df550',
password: '78b7dc88f9f4bf19c2b1aabfdd995244',
pandavmsHost: 'ws://192.168.8.30:7000/',
address: 'C83178215',
params: {
name: 1,
title: 2,
}
};
VideoParam = {
id: 'E75C657B-23D8-4F47-82F7-011825307468',
name: '球机-设备间正面',
channel: 5,
protocol: '萤石EZOPEN',
username: '014d7fd22a3f480d9b3492b3cc395717',
password: 'c077bd1c448e68cdee2be1d307731eae',
pandavmsHost: 'ws://192.168.8.30:7000/',
address: 'AH2684639',
params: {
name: 1,
title: 2,
}
};
VideoParam = {
id: '38FB4BA7-C61F-466C-9B57-5B401441DABC',
name: 'K21319413_通道_1',
protocol: '萤石云HTTP-FLV',
username: '6c44c8e92d1c4d75a9818756025df550',
password: '78b7dc88f9f4bf19c2b1aabfdd995244',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: 'ws://192.168.10.182:7000/',
address: 'K21319413',
};
let VideoParam1 = {
id: 'CDCD0D7D-D18B-4FEE-AD4B-DF9CA50D2986',
name: '设备12_通道_9',
protocol: 'RTSP',
username: 'admin',
password: 'zls_1234@abcd',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: 'ws://192.168.8.30:7000/',
address: '172.16.19.2',
};
VideoParam1 = {
id: '1CD26291-A19B-4709-8AEB-94CFC01CABBE',
name: '回龙水厂_回龙药房及水池',
protocol: '海康ISC-RTSP',
username: '27565776',
password: '4HUFPqij3igUJ0xkQ2gm',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: 'ws://222.179.7.166:8200/',
address: '183.64.178.118',
gateway: true,
};
VideoParam1 = {
id: '28AC17B5-EE3D-404F-B897-EE83078A5794',
name: '回龙水厂_回龙球机',
protocol: '海康ISC-RTSP',
username: '27565776',
password: '4HUFPqij3igUJ0xkQ2gm',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: 'ws://222.179.7.166:8200/',
address: '183.64.178.118',
gateway: true,
};
VideoParam1 = {
id: '28AC17B5-EE3D-404F-B897-EE83078A5794',
name: '回龙水厂_回龙球机',
protocol: 'GB28181',
username: '27565776',
password: '4HUFPqij3igUJ0xkQ2gm',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: 'ws://192.168.12.74:7000/',
address: '183.64.178.118',
gateway: false,
videoUrl: "34020000001110000001/34020000001320000002",
}
/*{
id: '11F102BC-CE03-4E32-AE60-F297934DFE3F', // 398993BB-A795-4237-BE75-B6A7EC9D675
name: '琼海电信小区', // 设备名称
protocol:'萤石EZOPEN', // 萤石EZOPE 萤石HTTP-FLV RTSP GB28181
username: '6c44c8e92d1c4d75a9818756025df550',
password: '78b7dc88f9f4bf19c2b1aabfdd995244',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: `ws://192.168.8.27:9876/`, // pandavms后端主机地址 eg: ws://172.16.19.19:8080/
address: '236644034',
// width: 952,
// height: 500,
}; */
// VideoParam = {
// id: '819DE637-BB78-49EB-9FBD-02907A3C1141', // 398993BB-A795-4237-BE75-B6A7EC9D675
// name: '锦绣豪庭_通道_2', // 设备名称
// protocol: '萤石EZOPEN', // 萤石EZOPE 萤石HTTP-FLV RTSP GB28181
// username: 'cd12d49994a04fb2839037d3f559a801',
// password: '24ecede07e9be5c5fccb85ccfec5e1ba',
// dataRate: 'Sub', // Main 主码流 Sub 子码流
// pandavmsHost: 'ws://221.229.200.85:8086/', // pandavms后端主机地址 eg: ws://172.16.19.19:8080/
// address: 'F65095407',
// channel: 2,
// options:{ // 不传递默认是今天的回放
// begin: '20231010000000', // 回放开始时间
// end: '20231010235959', // 回放结束时间
// },
// type:'rec', // 回放标识
// };
// VideoParam = {
// id: 'D21D9F91-F546-4A54-AE31-8E30A83214B2', // 398993BB-A795-4237-BE75-B6A7EC9D675
// name: '金山蓝景_通道_1', // 设备名称
// protocol: '萤石EZOPEN', // 萤石EZOPE 萤石HTTP-FLV RTSP GB28181
// username: '6c44c8e92d1c4d75a9818756025df550',
// password: '78b7dc88f9f4bf19c2b1aabfdd995244',
// dataRate: 'Sub', // Main 主码流 Sub 子码流
// pandavmsHost: 'ws://120.194.86.66:8096/', // pandavms后端主机地址 eg: ws://172.16.19.19:8080/
// address: 'F97957614',
// channel: 1,
// options:{ // 不传递默认是今天的回放
// begin: '20231010000000', // 回放开始时间
// end: '20231010235959', // 回放结束时间
// },
// type:'rec', // 回放标识
// };
useEffect(() => {
// 事件 ,返回视频信息
jessibuca &&
jessibuca.current &&
jessibuca.current.on('videoInfo', function (data) {
console.log('width:', data.width, 'height:', data.width);
});
// 事件 ,播放视频之后的回调
jessibuca &&
jessibuca.current &&
jessibuca.current.on('play', function (data) {
console.log('play:', jessibuca);
});
// 事件 ,暂停视频之后的回调
jessibuca &&
jessibuca.current &&
jessibuca.current.on('pause', function (data) {
console.log('pause:', data);
});
// ******
// 其他事件需查看在线文档
// ******
return () => {
console.log('销毁。。。。。。。。。。。。。。。。。。。。。。。。。');
// stopVideo();
};
}, []);
const stopVideo = () => {
jessibuca.current.pause && jessibuca.current.pause();
};
const startVideo = () => {
if (jessibuca && jessibuca.current) {
jessibuca.current.play();
// console.log(jessibuca.current.isPlaying());
}
};
const testVideo = () => {
// console.log(jessibuca.current.isPlaying());
};
const destroyVideo = () => {
if (VideoParam.protocol != '萤石EZOPEN')
jessibuca && jessibuca.current && jessibuca.current.destroy();
};
return (
<div>
<button onClick={stopVideo}>暂停</button>
<button onClick={startVideo}>开始</button>
<button onClick={testVideo}>测试</button>
<button onClick={destroyVideo}>销毁</button>
<div style={{ height: '700px' }}>
<Video {...{ JessibucaObj: JessibucaObj, VideoInfo: VideoParam }} ref={jessibuca} />
</div>
<div style={{ height: '700px' }}>
<Video {...{ JessibucaObj: JessibucaObj, VideoInfo: VideoParam1 }} ref={jessibuca} />
</div>
</div>
);
};
export default Demo1;