WeChat applet - page background music player control (music box icon rotates 360° animation and can be clicked to pause and play)

foreword

Because the video cannot be inserted, what you see is the rendering (actually controlling the music), and it runs with background music .

By default, the music is played directly, and the user can click to pause and resume playback.

In addition to the basic functions, monitoring of playback, pause, and errors is also done, and you can expand it according to your business.

insert image description here

sample code

The code is clean and tidy (with super detailed comments), without any redundancy and waste code, and can be freely expanded according to the business.

It is recommended that you open the official WeChat documentation to view more functions,

Just find a page, copy the following code, and run it directly:

<!--index.wxml-->

<view class

Guess you like

Origin blog.csdn.net/weixin_44198965/article/details/123699131