1***@163.com
1***@163.com
  • 发布:2023-10-17 17:14
  • 更新:2023-11-06 14:46
  • 阅读:358

【报Bug】ios真机调试,mp3文件播放报错TypeError: Attempted to assign to readonly property. __ERROR

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 11.2.3 (20D91)

HBuilderX类型: 正式

HBuilderX版本号: 3.8.12

手机系统: iOS

手机系统版本号: iOS 15

手机厂商: 苹果

手机机型: 13 pro

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
复制代码var innerAudioContext = uni.createInnerAudioContext();  
innerAudioContext.autoplay = true;  
innerAudioContext.obeyMuteSwitch = false;  
innerAudioContext.src = 'url播放地址';  
innerAudioContext.play()

操作步骤:
复制代码var innerAudioContext = uni.createInnerAudioContext();  
innerAudioContext.autoplay = true;  
innerAudioContext.obeyMuteSwitch = false;  
innerAudioContext.src = 'url播放地址';  
innerAudioContext.play()

预期结果:

按官网文档可正常使用

实际结果:

控制台报错,音频无法播放
17:02:44.108 [Vue warn]: Error in v-on handler: "TypeError: Attempted to assign to readonly property."[ERROR] : [Vue warn]: Error in v-on handler: "TypeError: Attempted to assign to readonly property."(found at pages/index.vue:1) ERROR
17:02:44.109 TypeError: Attempted to assign to readonly property.
ERROR

bug描述:

mp3文件播放报错
设置 innerAudioContext.obeyMuteSwitch = false; 后控制台报错如下:
TypeError: Attempted to assign to readonly property. __ERROR
不设置,可以播放

2023-10-17 17:14 负责人:无 分享
已邀请:
m***@163.com

m***@163.com

obeyMuteSwitch 只能在小程序端使用,APP没法用的。

要回复问题请先登录注册

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容