修改VideoPlayer组件的播放类型为Remote
This commit is contained in:
@@ -337,8 +337,8 @@
|
||||
"__prefab": null,
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 384,
|
||||
"height": 672
|
||||
"width": 672,
|
||||
"height": 864
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -357,7 +357,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": null,
|
||||
"_resourceType": 1,
|
||||
"_resourceType": 0,
|
||||
"_remoteURL": "",
|
||||
"_clip": null,
|
||||
"_playOnAwake": true,
|
||||
|
||||
@@ -338,7 +338,7 @@ export default class ResManager {
|
||||
spttemp.frameUrl = url;
|
||||
// 加载
|
||||
assetManager.loadRemote<ImageAsset>(url, (err, res: ImageAsset) => {
|
||||
console.log("加载远程图片: ", url);
|
||||
console.log("changeRemoteSpriteFrame方法加载远程图片: ", url);
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
@@ -361,26 +361,31 @@ export default class ResManager {
|
||||
/** 加载远程视频 */
|
||||
loadRemoteVideo(spt: VideoPlayer, url: string, cb: Function = null) {
|
||||
if (!spt || !url) return;
|
||||
// 临时加了一个字段,用来保存当前加载的资源路径
|
||||
let spttemp:any = spt;
|
||||
// 在异步回调时判断这个组件是不是还在加载同一个 url,避免多次调用时产生覆盖冲突
|
||||
spttemp.frameUrl = url;
|
||||
// 加载
|
||||
assetManager.loadRemote<VideoClip>(url, (err, res: VideoClip) => {
|
||||
console.log("加载远程视频: ", url);
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
if (!spt.isValid) {
|
||||
return;
|
||||
}
|
||||
if (spttemp.frameUrl != url) {
|
||||
return;
|
||||
}
|
||||
spt.clip = res;
|
||||
cb && cb(res);
|
||||
})
|
||||
// // 临时加了一个字段,用来保存当前加载的资源路径
|
||||
// let spttemp:any = spt;
|
||||
// // 在异步回调时判断这个组件是不是还在加载同一个 url,避免多次调用时产生覆盖冲突
|
||||
// spttemp.frameUrl = url;
|
||||
// // 加载
|
||||
// assetManager.loadRemote<VideoClip>(url, (err, res: VideoClip) => {
|
||||
// console.log("加载远程视频: ", url);
|
||||
// if (err) {
|
||||
// console.error(err);
|
||||
// return;
|
||||
// }
|
||||
// if (!spt.isValid) {
|
||||
// return;
|
||||
// }
|
||||
// if (spttemp.frameUrl != url) {
|
||||
// return;
|
||||
// }
|
||||
// spt.clip = res;
|
||||
// cb && cb(res);
|
||||
// })
|
||||
|
||||
console.log("loadRemoteVideo方法加载远程视频: ", url);
|
||||
spt.resourceType = VideoPlayer.ResourceType.REMOTE;
|
||||
spt.remoteURL = url;
|
||||
cb && cb(null);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user