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

feat: 修改视频回放

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