# wx.playBackgroundAudio(Object object)
From base library 1.2.0 Start, this interface stops maintenance, please use wx.getBackgroundAudioManager replace
with Promise style call: Supported
Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6
Use a background player to play music. For WeChat clients, there can only be one background music playing at the same time. When the user leaves the Mini Program, the music will stop playingWhen the user occupies the music player in other Mini Program, the music in original Mini Program will stop playing.
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
dataUrl | string | yes | Music links, currently supported formats are m4a, aac, mp3, wav | |
title | string | no | Music titles | |
coverImgUrl | string | no | Cover URL | |
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# sample code
wx.playBackgroundAudio({
dataUrl: '',
title: '',
coverImgUrl: ''
})