# playAudio ^6.8

播放录音

# 请求参数

Prop Type Value Comment
url String - 播放录音的地址
loop Boolean - 是否循环播放

# 接口调用示例

let params = {
  url: 'Sounds/20200827x.wav',
  loop: false
}

this.$bridge
  .playAudio(params)
  .then(res => {
    this.$alert(res)
  })
  .catch(err => {
    this.$toast(err)
  })
// bridge v0.2.3起支持回调函数,回调函数可触发多次
this.$bridge
  .playAudio(
    params,
    res => {
      this.$alert(res)
    },
    err => {
      this.$toast(err)
    }
  )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# 返回参数

  • 成功时返回
Prop Type Comment
code Number 1 播放完成
msg String -

# 返回示例


{
    "code": 0,
    "msg": "success"
}

1
2
3
4
5
6
Last Updated: 11/9/2023, 3:28:01 PM