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