fix(staff)
This commit is contained in:
parent
20cfaf00bb
commit
35fcd85046
|
@ -93,6 +93,7 @@
|
|||
"build": "node scripts/build.js",
|
||||
"test": "node scripts/test.js"
|
||||
},
|
||||
"proxy":"https://www.hswzct.cn:12016",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
|
|
|
@ -45,6 +45,7 @@ const FileListPage = (props: any) => {
|
|||
};
|
||||
useEffect(() => {
|
||||
getFileList();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [id]);
|
||||
const getFileTypeFromUrl = (url) => {
|
||||
if (url === "" || url.length === 0) return;
|
||||
|
|
|
@ -27,8 +27,6 @@ const WhichVideo = (props) => {
|
|||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
|
||||
|
||||
const fetchUrl = async () => {
|
||||
try {
|
||||
const reqs = await homeStore.getChannerStrem(deviceId, id);
|
||||
|
@ -42,7 +40,7 @@ const WhichVideo = (props) => {
|
|||
fetchUrl()
|
||||
timer = setInterval( () => {
|
||||
fetchUrl();
|
||||
},15000);
|
||||
},35000);
|
||||
|
||||
};
|
||||
return (
|
||||
|
|
|
@ -8,14 +8,28 @@ const HomeVideo = (props: Store) => {
|
|||
const { homeStore } = props;
|
||||
const [videoUrls, setVideoUrl] = useState<Array<string> | null>([]);
|
||||
const [showVideo, setShowVideo] = useState<boolean>(false);
|
||||
let timer: any = null;
|
||||
const [obj, setPbj] = useState<any>({
|
||||
width: "300px",
|
||||
});
|
||||
useEffect(() => {
|
||||
const fetchUrl = () => {
|
||||
homeStore.getNewTask().then((res) => {
|
||||
setVideoUrl(res);
|
||||
setShowVideo(homeStore.showVideo);
|
||||
});
|
||||
setShowVideo(homeStore.showVideo);
|
||||
};
|
||||
useEffect(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
fetchUrl();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
timer = setInterval(() => {
|
||||
fetchUrl();
|
||||
}, 35000);
|
||||
return () => {
|
||||
clearInterval(timer);
|
||||
};
|
||||
}, [homeStore, homeStore.showVideo]);
|
||||
return (
|
||||
<div className="homeVideos">
|
||||
|
@ -46,7 +60,10 @@ const HomeVideo = (props: Store) => {
|
|||
<div className="homeVideoBox" style={obj}>
|
||||
{videoUrls?.map((videoUrl, index) => {
|
||||
return (
|
||||
<div key={videoUrl} style={{ flex: "1", margin: "5px",height:"200px"}}>
|
||||
<div
|
||||
key={videoUrl}
|
||||
style={{ flex: "1", margin: "5px", height: "200px" }}
|
||||
>
|
||||
<VideoTow url={videoUrl} className="homeVideo" />;
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -21,37 +21,42 @@ const EasyPlayer = (props: Store) => {
|
|||
WCS: true,
|
||||
hasAudio: false,
|
||||
};
|
||||
|
||||
// 在组件挂载后创建播放器实例
|
||||
useEffect(() => {
|
||||
const init = () => {
|
||||
if (easyPro.current) {
|
||||
easyPro.current?.destroy().then(() => {
|
||||
if (props.url){
|
||||
if (props.url) {
|
||||
create();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (props.url){
|
||||
if (props.url) {
|
||||
create();
|
||||
}
|
||||
}
|
||||
};
|
||||
// 在组件挂载后创建播放器实例
|
||||
useEffect(() => {
|
||||
init()
|
||||
|
||||
return () => {
|
||||
if (easyPro.current) {
|
||||
easyPro.current.destroy()
|
||||
easyPro.current.destroy();
|
||||
}
|
||||
};
|
||||
}, [props.url],);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.url]);
|
||||
|
||||
// 创建播放器实例
|
||||
const create = () => {
|
||||
easyPro.current = new window.EasyPlayerPro(myRef.current, {
|
||||
isLive: config.isLive,
|
||||
bufferTime: config.bufferTime,
|
||||
stretch: config.stretch,
|
||||
stretch: false,
|
||||
MSE: config.MSE,
|
||||
WCS: config.WCS,
|
||||
hasAudio: config.hasAudio,
|
||||
watermark: { text: { content: "easyplayer-pro" }, right: 10, top: 10 },
|
||||
isMute: false,
|
||||
});
|
||||
play();
|
||||
};
|
||||
|
@ -65,7 +70,7 @@ const EasyPlayer = (props: Store) => {
|
|||
console.log("player started");
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("error", e);
|
||||
console.error("player error", e);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Config {
|
||||
// static baseUrl = "https://www.hswzct.cn:12016/";
|
||||
static baseUrl = "http://127.0.0.1:12214/";
|
||||
// static baseUrl = "/";
|
||||
static baseUrl = "https://www.hswzct.cn:12016/";
|
||||
// static baseUrl = "http://127.0.0.1:12214/";
|
||||
static ws = "wss://www.hswzct.cn:12016/wsadmin?id=admin";
|
||||
static userStatic = "https://www.hswzct.cn:12016/api/uploads/user/";
|
||||
static videoApi = "https://sprh.hswzct.cn:4443"; //
|
||||
|
|
Loading…
Reference in New Issue