async loadVideo(videoList) {
console.log('goloadvideo', videoList)
const scene = this.scene
if (videoList.length > 0) {
const videoIdList = [];
const videos = await Promise.all(videoList.map((videoItem) => {
videoIdList.push(videoItem.id);
return scene.assets.loadAsset({
type: 'video-texture',
assetId: `video-${videoItem.id}`,
src: `https:${videoItem.mediaUrl}`
})
}))
videos.map((videoTexture, index) => {
const videoMat = scene.createMaterial(
scene.assets.getAsset('effect', 'standard'), {
u_baseColorMap: videoTexture.value.texture
}
)
scene.assets.addAsset('material', `video-mat-${videoList[index].id}`, videoMat)
})
console.log('video asset loaded')
this.setData({
videoIdList: videoIdList,
// videoLoaded: false
})
} else {
console.log('goloadvideo2', videoList)
this.setData({
videoIdList: [],
videoLoaded: false
})
}
},
根据官方示例的加载视频方法,经常会出现loadAsset步骤中卡住,重新进入有时候会成功,在加载多个视频中一直都会卡住
模拟器中总是成功,预览真机调试和体验版总是经常卡在loadAsset