app.js 1.0 KB

12345678910111213141516171819202122232425262728
  1. App({
  2. onLaunch() {
  3. // this.checkAudio()
  4. },
  5. checkAudio() {
  6. wx.getSystemInfo({
  7. success: (res) => {
  8. if (res.platform !== 'devtools') {
  9. wx.getNetworkType({
  10. success: (res) => {
  11. if (res.networkType === 'wifi') {
  12. this.autoPlay()
  13. }
  14. },
  15. })
  16. }
  17. },
  18. })
  19. },
  20. autoPlay() {
  21. const backgroundAudioManager = wx.getBackgroundAudioManager()
  22. backgroundAudioManager.title = '小鸡哔哔'
  23. backgroundAudioManager.epname = '洛天依小鸡哔哔'
  24. backgroundAudioManager.singer = '洛天依'
  25. backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000000PKgrQ10ZW56.jpg?max_age=2592000'
  26. backgroundAudioManager.src = 'http://cdn.skyvow.cn/%E6%B4%9B%E5%A4%A9%E4%BE%9D%20-%20%E5%B0%8F%E9%B8%A1%E5%93%94%E5%93%94.mp3'
  27. },
  28. })