Home > Article > WeChat Applet > Example of WeChat applet using audio component to play music
We have shared a lot of tutorials about WeChat mini programs before. In this article, we mainly introduce the function of using the audio component of WeChat mini programs to play music, and analyze the operation skills related to the audio components of WeChat mini programs to play online music in the form of examples, and come with source code for Readers can download it for reference. Friends who need it can refer to it. I hope it can help everyone.
1. Effect display
##2. Key code
① index.wxmlCopy code The code is as follows:
<audio src="{{audioSrc}}" poster="{{audioPoster}}" name="{{audioName}}" author="{{audioAuthor}}" controls></audio>② index.js
Page({ data: { audioPoster: 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000', audioName: '此时此刻', audioAuthor: '许巍', audioSrc: 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46', } })Everyone can learn Yet? Hurry up and try it yourself.
Functional implementation of user-defined templates in WeChat mini program
WeChat mini program that implements the tab function Program
The most complete WeChat mini program project example
The above is the detailed content of Example of WeChat applet using audio component to play music. For more information, please follow other related articles on the PHP Chinese website!