Commit 05a52909 authored by 李纪文's avatar 李纪文

feat: 视频回放展示优化

parent 1ad946bf
...@@ -37,7 +37,7 @@ export function controlSlim(data) { ...@@ -37,7 +37,7 @@ export function controlSlim(data) {
// 获取isc ws回看流 // 获取isc ws回看流
export function hiswsUrl(data) { export function hiswsUrl(data) {
return request({ return request({
url: `${baseURI}${CommonPath}/PandaCore/GateWay/pandavms/camera/isc/hiswsurl`, url: `${baseURI}${CommonPath}/pandavms/camera/isc/hiswsurl`,
method: REQUEST_METHOD_POST, method: REQUEST_METHOD_POST,
data, data,
}); });
......
...@@ -13,12 +13,13 @@ const Demo2 = (props) => { ...@@ -13,12 +13,13 @@ const Demo2 = (props) => {
}, },
VideoInfo: { VideoInfo: {
id: 'FB4FAC6B-4AC1-4EE6-8133-A613098F5AEF', id: 'FB4FAC6B-4AC1-4EE6-8133-A613098F5AEF',
beginTime: '2024-05-20 00:00:00', beginTime: '2024-05-24 00:00:00',
endTime: '2024-05-20 23:59:59', endTime: '2024-05-24 23:59:59',
playTime: '2024-05-20 06:00:00', playTime: '2024-05-24 06:00:00',
hoursRuler: 24, hoursRuler: 24,
}, },
ProgressBar: { strokeColor: 'red', textColor: 'red' }, ProgressBar: { strokeColor: 'red', textColor: 'red' },
EmptyIcon: '',
}} }}
ref={jessibuca} ref={jessibuca}
/> />
......
...@@ -22,7 +22,7 @@ const HKh5player = (props, ref) => { ...@@ -22,7 +22,7 @@ const HKh5player = (props, ref) => {
const IS_MOVE_DEVICE = document.body.clientWidth < 992; // 是否移动设备 const IS_MOVE_DEVICE = document.body.clientWidth < 992; // 是否移动设备
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('hk-h5-player-view'); const prefixCls = getPrefixCls('hk-h5-player-view');
const { VideoInfo = {}, JessibucaObj, ProgressBar } = props; const { VideoInfo = {}, JessibucaObj, ProgressBar, EmptyIcon = '' } = props;
const videoID = VideoInfo?.id || `VIDEO_PLAY_BACK`; const videoID = VideoInfo?.id || `VIDEO_PLAY_BACK`;
const [showId, setShowId] = useState(VideoInfo?.id || ''); //视频ID const [showId, setShowId] = useState(VideoInfo?.id || ''); //视频ID
const [peridos, setPeridos] = useState([]); //可播放视频时间段 const [peridos, setPeridos] = useState([]); //可播放视频时间段
...@@ -100,7 +100,10 @@ const HKh5player = (props, ref) => { ...@@ -100,7 +100,10 @@ const HKh5player = (props, ref) => {
if (!id) return setShowId(null); if (!id) return setShowId(null);
const hoursPerRuler = calculateHours(beginTime, endTime) || 24; const hoursPerRuler = calculateHours(beginTime, endTime) || 24;
const stTimes = moment(beginTime).format('YYYY-MM-DD HH:mm:ss'); const stTimes = moment(beginTime).format('YYYY-MM-DD HH:mm:ss');
const edTimes = moment(endTime).format('YYYY-MM-DD HH:mm:ss'); const edTimes =
moment(new Date()).valueOf() >= moment(endTime).valueOf()
? moment(endTime).format('YYYY-MM-DD HH:mm:ss')
: moment(new Date()).format('YYYY-MM-DD HH:mm:ss');
const params = { const params = {
id: id, id: id,
startTime: stTimes, startTime: stTimes,
...@@ -120,7 +123,8 @@ const HKh5player = (props, ref) => { ...@@ -120,7 +123,8 @@ const HKh5player = (props, ref) => {
}, },
]); ]);
setLoading(true); setLoading(true);
hiswsUrl(params).then((res) => { hiswsUrl(params)
.then((res) => {
setLoading(false); setLoading(false);
if (res.code === 200) { if (res.code === 200) {
const data = res?.data || ''; const data = res?.data || '';
...@@ -128,13 +132,19 @@ const HKh5player = (props, ref) => { ...@@ -128,13 +132,19 @@ const HKh5player = (props, ref) => {
if (!url) return setShowId(null); if (!url) return setShowId(null);
videoUrl.current = url; videoUrl.current = url;
getVideoReplayInfo({ getVideoReplayInfo({
beginTime: playTimestamp ? moment(playTimestamp).format('YYYY-MM-DD HH:mm:ss') : stTimes, beginTime: playTimestamp
? moment(playTimestamp).format('YYYY-MM-DD HH:mm:ss')
: stTimes,
endTime: edTimes, endTime: edTimes,
}); });
} else { } else {
setShowId(null); setShowId(null);
message.warn(res.msg); message.warn(res.msg);
} }
})
.catch((err) => {
setLoading(false);
setShowId(null);
}); });
}; };
...@@ -462,7 +472,7 @@ const HKh5player = (props, ref) => { ...@@ -462,7 +472,7 @@ const HKh5player = (props, ref) => {
if (recordInfo && playOffset) { if (recordInfo && playOffset) {
setPlayTimestamp(time); setPlayTimestamp(time);
} else { } else {
message.warn('当前时间节点没有视频可以播放哦!'); message.warn('当前时间节点超出回放时间区间!');
} }
}} }}
timecell={peridos} timecell={peridos}
...@@ -523,7 +533,11 @@ const HKh5player = (props, ref) => { ...@@ -523,7 +533,11 @@ const HKh5player = (props, ref) => {
const emptyBoxRender = () => { const emptyBoxRender = () => {
return ( return (
<div className={classNames(`${prefixCls}-empty`)}> <div className={classNames(`${prefixCls}-empty`)}>
<Empty image={empty_icon} theme={'dark'} description={'咦~暂时没有查询到视频回放信息呢~'} /> <Empty
image={EmptyIcon || empty_icon}
theme={'dark'}
description={'咦~暂时没有查询到视频回放信息呢~'}
/>
</div> </div>
); );
}; };
......
...@@ -13,7 +13,7 @@ const RecVideo = (props, ref) => { ...@@ -13,7 +13,7 @@ const RecVideo = (props, ref) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('rec-video-view'); const prefixCls = getPrefixCls('rec-video-view');
const { VideoInfo, JessibucaObj, ProgressBar } = props; const { VideoInfo, JessibucaObj, ProgressBar, EmptyIcon = '', } = props;
const jessibuca = useRef(null); const jessibuca = useRef(null);
const [hoursRuler, setHoursRuler] = useState(VideoInfo.hoursRuler || 24); const [hoursRuler, setHoursRuler] = useState(VideoInfo.hoursRuler || 24);
const [showId, setShowId] = useState(null); //视频ID const [showId, setShowId] = useState(null); //视频ID
...@@ -196,7 +196,7 @@ const RecVideo = (props, ref) => { ...@@ -196,7 +196,7 @@ const RecVideo = (props, ref) => {
) : ( ) : (
<div className={classNames(`${prefixCls}-empty`)}> <div className={classNames(`${prefixCls}-empty`)}>
<Empty <Empty
image={empty_icon} image={EmptyIcon || empty_icon}
theme={'dark'} theme={'dark'}
description={'咦~暂时没有查询到视频回放信息呢~'} description={'咦~暂时没有查询到视频回放信息呢~'}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment