Merge branch 'main' of 47.107.44.202:xionglijia/18xchat

This commit is contained in:
2025-09-18 15:42:19 +08:00
2 changed files with 29 additions and 24 deletions
+3 -3
View File
@@ -337,8 +337,8 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 384, "width": 672,
"height": 672 "height": 864
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -357,7 +357,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"_resourceType": 1, "_resourceType": 0,
"_remoteURL": "", "_remoteURL": "",
"_clip": null, "_clip": null,
"_playOnAwake": true, "_playOnAwake": true,
+26 -21
View File
@@ -338,7 +338,7 @@ export default class ResManager {
spttemp.frameUrl = url; spttemp.frameUrl = url;
// 加载 // 加载
assetManager.loadRemote<ImageAsset>(url, (err, res: ImageAsset) => { assetManager.loadRemote<ImageAsset>(url, (err, res: ImageAsset) => {
console.log("加载远程图片: ", url); console.log("changeRemoteSpriteFrame方法加载远程图片: ", url);
if (err) { if (err) {
console.log(err); console.log(err);
return return
@@ -361,26 +361,31 @@ export default class ResManager {
/** 加载远程视频 */ /** 加载远程视频 */
loadRemoteVideo(spt: VideoPlayer, url: string, cb: Function = null) { loadRemoteVideo(spt: VideoPlayer, url: string, cb: Function = null) {
if (!spt || !url) return; if (!spt || !url) return;
// 临时加了一个字段,用来保存当前加载的资源路径 // // 临时加了一个字段,用来保存当前加载的资源路径
let spttemp:any = spt; // let spttemp:any = spt;
// 在异步回调时判断这个组件是不是还在加载同一个 url,避免多次调用时产生覆盖冲突 // // 在异步回调时判断这个组件是不是还在加载同一个 url,避免多次调用时产生覆盖冲突
spttemp.frameUrl = url; // spttemp.frameUrl = url;
// 加载 // // 加载
assetManager.loadRemote<VideoClip>(url, (err, res: VideoClip) => { // assetManager.loadRemote<VideoClip>(url, (err, res: VideoClip) => {
console.log("加载远程视频: ", url); // console.log("加载远程视频: ", url);
if (err) { // if (err) {
console.error(err); // console.error(err);
return; // return;
} // }
if (!spt.isValid) { // if (!spt.isValid) {
return; // return;
} // }
if (spttemp.frameUrl != url) { // if (spttemp.frameUrl != url) {
return; // return;
} // }
spt.clip = res; // spt.clip = res;
cb && cb(res); // cb && cb(res);
}) // })
console.log("loadRemoteVideo方法加载远程视频: ", url);
spt.resourceType = VideoPlayer.ResourceType.REMOTE;
spt.remoteURL = url;
cb && cb(null);
} }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////