1***@qq.com
1***@qq.com
  • 发布:2022-08-18 11:58
  • 更新:2022-08-18 16:48
  • 阅读:415

【报Bug】 uni.createInnerAudioContext() 设置obeyMuteSwitch报错

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: macOS Monterey 12.3.1

手机系统: iOS

手机系统版本号: iOS 15

手机厂商: 苹果

手机机型: iPhone 11

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: CLI

CLI版本号: 2.0.1

示例代码:

this.AUDIO = uni.createInnerAudioContext()
this.AUDIO.src = this.music.src
this.AUDIO.obeyMuteSwitch = false
this.AUDIO.onCanplay(() => {
console.log(' --- onCanplay = ', this.AUDIO.duration)
this.total_time = this.getMinuteTime(this.AUDIO.duration)
this.trueTime = this.AUDIO.duration
this.AUDIO.autoplay = false

    })

操作步骤:

this.AUDIO = uni.createInnerAudioContext()
this.AUDIO.src = this.music.src
this.AUDIO.obeyMuteSwitch = false
this.AUDIO.onCanplay(() => {
console.log(' --- onCanplay = ', this.AUDIO.duration)
this.total_time = this.getMinuteTime(this.AUDIO.duration)
this.trueTime = this.AUDIO.duration
this.AUDIO.autoplay = false

    })

预期结果:

真机正常播放

实际结果:

报错,TypeError: Cannot set property obeyMuteSwitch of #<rp> which has only a getter

bug描述:

设置this.AUDIO.obeyMuteSwitch = false后报错 TypeError: Cannot set property obeyMuteSwitch of #<rp> which has only a getter

2022-08-18 11:58 负责人:无 分享
已邀请:
DCloud_UNI_Anne
  • 1***@qq.com (作者)

    好的,APP IOS端没声音(手机没开启静音模式),Android端正常,请问有没有解决方法

    2022-08-24 11:40

该问题目前已经被锁定, 无法添加新回复