WeChat Mini Programs uses the wx.playBackgroundAudio (OBJECT) method to cut the background music after playing.

1 use the wx.playBackgroundAudio (OBJECT) method on the page (switching to background) onhide () to play background music can report an error in the real machine in the development tool?
Code both methods are the same
onHide: function () {

  // const backgroundAudioManager = wx.getBackgroundAudioManager()
  // backgroundAudioManager.title = ""
  // backgroundAudioManager.epname = ""
  // backgroundAudioManager.singer = ""
  // backgroundAudioManager.coverImgUrl = "http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000"
  // backgroundAudioManager.src = "http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46" //  src 

  wx.playBackgroundAudio({
      dataUrl: "http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46",
      title: "",
      coverImgUrl: "http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000",
      success(res){
        console.log("" , res )
      },
      fail(res){
        console.log( "" , res )
      }
  })
  console.log( "" )

}
results
Development tools
clipboard.png

clipboard.png


I have a similar problem today. The solution (test) is to configure "requiredBackgroundModes": ["audio"] in app.json. I hope I can help more people who see this problem.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3e591-4cb47.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3e591-4cb47.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?