收藏
回答

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步骤中卡住,重新进入有时候会成功,在加载多个视频中一直都会卡住

回答关注问题邀请回答
收藏

1 个回答

  • 偏执狂
    偏执狂
    2023-03-29

    模拟器中总是成功,预览真机调试和体验版总是经常卡在loadAsset

    2023-03-29
    有用
    回复 3
    • 被潇潇迷晕头
      被潇潇迷晕头
      2023-03-29
      解决了吗
      2023-03-29
      回复
    • 偏执狂
      偏执狂
      2023-03-30回复被潇潇迷晕头
      还没有
      2023-03-30
      回复
    • 灰太狼
      灰太狼
      2023-12-10
      解决了嘛?我这真机调试也都是卡着但是开发者工具不会
      2023-12-10
      回复
登录 后发表内容