Commit b3f38373 authored by 李纪文's avatar 李纪文

feat: 修改视频回放

parent 9a116785
......@@ -23,7 +23,7 @@ const HKh5player = (props, ref) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('hk-h5-player-view');
const { VideoInfo = {}, JessibucaObj, ProgressBar, EmptyIcon = '' } = props;
const videoID = VideoInfo?.id || `VIDEO_PLAY_BACK`;
const videoID = VideoInfo?.id || `VIDEO_PLAY_BACK${Date.now().toString(36)}`;
const [showId, setShowId] = useState(VideoInfo?.id || ''); //视频ID
const [peridos, setPeridos] = useState([]); //可播放视频时间段
const [hoursRuler, setHoursRuler] = useState(VideoInfo.hoursRuler || 24);
......@@ -46,12 +46,15 @@ const HKh5player = (props, ref) => {
const player = useRef(null);
useEffect(() => {
setShowId(props?.VideoInfo?.id || '');
setHoursRuler(props?.VideoInfo.hoursRuler || 24);
setPlayTimestamp(props?.VideoInfo?.playTime ? moment(props?.VideoInfo?.playTime).valueOf() : null);
changeReplayCfg?.();
// 设置播放容器的宽高并监听窗口大小变化
window.addEventListener('resize', resizeVideo);
return () => {
window.removeEventListener('resize', resizeVideo);
player.current?.JS_StopRealPlayAll?.();
player.current?.JS_Destroy?.();
player.current = null;
};
// eslint-disable-next-line react-hooks/exhaustive-deps
......
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