parameter.src should be String instead of Undefined;"

微信小程序的网址不能打印出来吗?
上传视频后返回了tempfiles,我想要提取出其中的tempfilepath,但是一直在无法识别,提示我类型错了。
参考代码是https://blog.csdn.net/zhoulib__/article/details/125641526?spm=1001.2014.3001.5506里的,代码问题如下图:

img

img


我的代码如下:

Page({
  // 链接可能会过期换成自己的就行
    data:{
       //"audioUrl": "https://dl.stream.qqmusic.qq.com/C4000026gMkr1L9tKN.m4a?guid=7840612806&vkey=4696DBD6111F38EC3D75D0F4FDF769B3736068A795CF585BA18DF3A4BCD8F83D0662B54D70F64934AF74A34C9A354AFF0AA4660CCE4C66F0&uin=&fromtag=120032",
      videoUrl: "C:/Users/priesty/Desktop/caogao/test.mp4",
      videoInfo: {},
      canvasWidth: 0,
      canvasHeight: 0,
      fps: 0,
      duration: 0,
      imageList: [],
      tempFilePath:"",
    },
    onLoad() {
      console.log("开始"),
      this.videoDecoderStart()
    },
     // async是异步的意思,会返回一个promise对象,而awite会等待这个async的promise完成 并将reslove的结果返回出来
    async videoDecoderStart() {
      // 自己选择视频
      const that = this
/*       var {tempFilePath} = await wx.chooseMedia( */
      //const tempFilePath =  wx.chooseMedia(
        wx.chooseMedia(
        {
          sourceType: ['album'],
          success(res){
            console.log(res);
            //var tempFilePath = res.tempFilePath
            that.setData({        //在data维护一组数据 
              tempFilePath: res.tempFiles.tempFilePath
            })
            console.log(tempFilePath)   //无法识别,为什么?
          }
        }
      )
      console.log("选择")
      console.log(tempFilePath)        //还是无法识别?
      // 网络视频
     // wx.showLoading({
     //   title: '加载中...',
     // })
     // var {
     //   tempFilePath
     // } = await this.getTempPath(this.data.videoUrl)
     // wx.hideLoading()
      var videoInfo = await wx.getVideoInfo({
        src: that.data.tempFilePath          //这里一直报错
      })
      this.setData({
        videoInfo: videoInfo,
        canvasWidth: videoInfo.width,
        canvasHeight: videoInfo.height,
        duration: videoInfo.duration,
        fps: videoInfo.fps
      }, () => {
       // 创建视频解析器
      this.videoDecoder = wx.createVideoDecoder()
        const {
          canvas,
          context
        } = this.initOffscreenCanvas(this.data.canvasWidth, this.data.canvasWidth)
        this.videoDecoder.on("start", () => {
          this.videoDecoder.seek(0)
          this.timer = setInterval(() => {
             this.getFrameData(canvas, context)
          }, 300);
        })
        this.videoDecoder.on("seek", () => {})
        this.videoDecoder.on("stop", () => {})
        this.videoDecoder.start({
          source: tempFilePath
        })
      })
    },

问一下该怎么修改?

根据报错 是说 getvedioinfo参数得是个 string .但你现在是undefined .that.data.tempFilePath 你打印一下看看