Commit 443d79a6 authored by 李纪文's avatar 李纪文

feat: 修改视频回放

parent 26194513
...@@ -48,10 +48,9 @@ const HKh5player = (props, ref) => { ...@@ -48,10 +48,9 @@ const HKh5player = (props, ref) => {
useEffect(() => { useEffect(() => {
setShowId(props?.VideoInfo?.id || ''); setShowId(props?.VideoInfo?.id || '');
setHoursRuler(props?.VideoInfo.hoursRuler || 24); setHoursRuler(props?.VideoInfo.hoursRuler || 24);
setPlayTimestamp( const playTimes = props?.VideoInfo?.playTime ? moment(props?.VideoInfo?.playTime).valueOf() : null;
props?.VideoInfo?.playTime ? moment(props?.VideoInfo?.playTime).valueOf() : null, setPlayTimestamp(playTimes);
); changeReplayCfg?.(playTimes);
changeReplayCfg?.();
// 设置播放容器的宽高并监听窗口大小变化 // 设置播放容器的宽高并监听窗口大小变化
window.addEventListener('resize', resizeVideo); window.addEventListener('resize', resizeVideo);
return () => { return () => {
...@@ -96,12 +95,12 @@ const HKh5player = (props, ref) => { ...@@ -96,12 +95,12 @@ const HKh5player = (props, ref) => {
}; };
// 更改播放配置 // 更改播放配置
const changeReplayCfg = () => { const changeReplayCfg = (playTimes) => {
const { const {
beginTime = moment().format('YYYY-MM-DD 00:00:00'), beginTime = moment().format('YYYY-MM-DD 00:00:00'),
endTime = moment().format('YYYY-MM-DD 23:59:59'), endTime = moment().format('YYYY-MM-DD 23:59:59'),
id = '', id = '',
} = VideoInfo || {}; } = props?.VideoInfo || {};
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');
...@@ -119,7 +118,7 @@ const HKh5player = (props, ref) => { ...@@ -119,7 +118,7 @@ const HKh5player = (props, ref) => {
setHoursRuler(hoursPerRuler); setHoursRuler(hoursPerRuler);
setMinTimestamp(moment(stTimes).valueOf()); setMinTimestamp(moment(stTimes).valueOf());
setMaxTimestamp(moment(edTimes).valueOf()); setMaxTimestamp(moment(edTimes).valueOf());
setPlayTimestamp(playTimestamp ? playTimestamp : moment(stTimes).valueOf()); setPlayTimestamp(playTimes ? playTimes : moment(stTimes).valueOf());
setPeridos([ setPeridos([
{ {
beginTime: moment(beginTime).valueOf(), beginTime: moment(beginTime).valueOf(),
...@@ -261,7 +260,7 @@ const HKh5player = (props, ref) => { ...@@ -261,7 +260,7 @@ const HKh5player = (props, ref) => {
const { const {
beginTime = moment().format('YYYY-MM-DD 00:00:00'), beginTime = moment().format('YYYY-MM-DD 00:00:00'),
endTime = moment().format('YYYY-MM-DD 23:59:59'), endTime = moment().format('YYYY-MM-DD 23:59:59'),
} = VideoInfo || {}; } = props?.VideoInfo || {};
const bgTimes = moment(beginTime).format('YYYY-MM-DD HH:mm:ss'); const bgTimes = moment(beginTime).format('YYYY-MM-DD HH:mm:ss');
const edTimes = moment(endTime).format('YYYY-MM-DD HH:mm:ss'); const edTimes = moment(endTime).format('YYYY-MM-DD HH:mm:ss');
player.current?.JS_GetOSDTime?.()?.then( player.current?.JS_GetOSDTime?.()?.then(
...@@ -402,7 +401,7 @@ const HKh5player = (props, ref) => { ...@@ -402,7 +401,7 @@ const HKh5player = (props, ref) => {
const { const {
beginTime = moment().format('YYYY-MM-DD 00:00:00'), beginTime = moment().format('YYYY-MM-DD 00:00:00'),
endTime = moment().format('YYYY-MM-DD 23:59:59'), endTime = moment().format('YYYY-MM-DD 23:59:59'),
} = VideoInfo || {}; } = props?.VideoInfo || {};
const bgTimes = moment(beginTime).format('YYYY-MM-DD HH:mm:ss'); const bgTimes = moment(beginTime).format('YYYY-MM-DD HH:mm:ss');
const edTimes = moment(endTime).format('YYYY-MM-DD HH:mm:ss'); const edTimes = moment(endTime).format('YYYY-MM-DD HH:mm:ss');
playbackStart({ playbackStart({
...@@ -469,7 +468,7 @@ const HKh5player = (props, ref) => { ...@@ -469,7 +468,7 @@ const HKh5player = (props, ref) => {
<div className={classNames(`${prefixCls}-time`)}> <div className={classNames(`${prefixCls}-time`)}>
{peridos.length ? ( {peridos.length ? (
<TimeSlider <TimeSlider
key={JSON.stringify(props?.VideoInfo || '{}')} key={JSON.stringify(props?.VideoInfo || {})}
minTimestamp={minTimestamp} minTimestamp={minTimestamp}
maxTimestamp={maxTimestamp} maxTimestamp={maxTimestamp}
hoursPerRuler={hoursRuler || 24} hoursPerRuler={hoursRuler || 24}
......
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