- xr-frame动态加载视频纹理video-texture静默报错?
if (videoList.length > 0) { console.log('goloadvideo1', videoList) const videoIdList = []; const videos = await Promise.all(videoList.map((videoItem) => { console.log(`video-${videoItem.id}`, 'https:' + videoItem.mediaUrl) videoIdList.push(videoItem.id); return scene.assets.loadAsset({ type: 'video-texture', assetId: `video-${videoItem.id}`, src: 'https:' + videoItem.mediaUrl, options: { loop: true }, }) })) console.log(videos) c从真机调试上只能看到console.log('goloadvideo1', videoList)和console.log(`video-${videoItem.id}`, 'https:' + videoItem.mediaUrl),代码没有走到console.log(videos)这一步 [图片]
2023-03-29 - xr-frame动态加载视频总是卡住?时好时坏?
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步骤中卡住,重新进入有时候会成功,在加载多个视频中一直都会卡住
2023-03-29