w***@yunjiumiao.com
w***@yunjiumiao.com
  • 发布:2024-04-27 08:46
  • 更新:2024-04-27 08:46
  • 阅读:39

【报Bug】uniApp 页面多次触发录音事件导致app闪退

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 4.08

手机系统: Android

手机系统版本号: Android 11

手机厂商: 小米

手机机型: 小米10青春版

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

/**

  • 初始化-录音监听事件
    */
    initRecorderListeners() {
    // 监听录音开始
    recorderManager.onStart(() => {
    let auRef
    if (this.isGroup) {
    auRef = this.$refs['actionRef' + this.currentUser.id][0]
    } else {
    auRef = this.$refs['actionRef']
    }
    auRef.audio.startTime = Date.now()
    auRef.audio.recording = true
    })

    //监听录音结束-发送
    recorderManager.onStop((res) => {

    let auRef, id  
    let endTime = Date.now()  
    id = this.currentUser.id  
    if (this.isGroup) {  
      auRef = this.$refs['actionRef' + this.currentUser.id][0]  
    } else {  
      auRef = this.$refs['actionRef']  
    }  
    
    let duration = endTime - auRef.audio.startTime  
    if (duration < 1000) {  
      uni.showToast({  
        icon: 'error',  
        title: '录音时间太短',  
        duration: 500  
      })  
      setTimeout(()=>{  
        auRef.audio.recording = false  
      },500)  
      return  
    }  
    res.duration = duration  
    this.sendAudioMessage(res.tempFilePath, id)  
    
    setTimeout(()=>{  
      auRef.audio.recording = false  
    },500)  

    })

操作步骤:

多次点击录音

预期结果:

不闪退

实际结果:

闪退

bug描述:

页面写了录音的监听,多次触发录音事件,直接闪退,控制台不输出任务错误日志

2024-04-27 08:46 负责人:无 分享
已邀请:

要回复问题请先登录注册