优化Video和Map

master
LiuJiaNan 2025-12-01 11:17:16 +08:00
parent 0b443c8a52
commit c80dde1826
2 changed files with 46 additions and 48 deletions

View File

@ -34,11 +34,8 @@ const MapSelector = (props) => {
// 初始化地图 // 初始化地图
const initMap = async () => { const initMap = async () => {
await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr");
if (!window.BMapGL) { if (!window.BMapGL) {
console.error("BMapGL is not loaded"); await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr");
return;
} }
setLoading(true); setLoading(true);

View File

@ -44,8 +44,11 @@ const AliPlayer = forwardRef(({
const onCreateAliPlayer = async () => { const onCreateAliPlayer = async () => {
if (!containerRef.current) if (!containerRef.current)
return; return;
if (!window.Aliplayer) {
await dynamicLoadJs("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js"); await dynamicLoadJs("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js");
await dynamicLoadCss("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css"); await dynamicLoadCss("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css");
}
onDisposeAliPlayer(); onDisposeAliPlayer();
const skinLayout = [ const skinLayout = [
@ -79,7 +82,6 @@ const AliPlayer = forwardRef(({
}); });
} }
if (typeof window.Aliplayer !== "undefined") {
playerRef.current = new window.Aliplayer( playerRef.current = new window.Aliplayer(
{ {
id: className, id: className,
@ -123,7 +125,6 @@ const AliPlayer = forwardRef(({
} }
}, },
); );
}
}; };
useEffect(() => { useEffect(() => {