Home  >  Article  >  WeChat Applet  >  Example of WeChat applet using audio component to play music

Example of WeChat applet using audio component to play music

小云云
小云云Original
2018-05-24 10:57:1713208browse

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.wxml

Copy code The code is as follows:

<audio src="{{audioSrc}}" poster="{{audioPoster}}" name="{{audioName}}" author="{{audioAuthor}}" controls></audio>

② index.js

Page({
 data: {
   audioPoster: &#39;http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000&#39;,
   audioName: &#39;此时此刻&#39;,
   audioAuthor: &#39;许巍&#39;,
   audioSrc: &#39;http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46&#39;,
 }
})

Everyone can learn Yet? Hurry up and try it yourself.


Related recommendations:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn