微信小程序 audio 組件實(shí)例詳解

音頻播放已經(jīng)封裝的很好!只需配合屬性設(shè)置即可! (method和data配合使用)
主要屬性:




wxml
<audio
action="{{action}}"
src='http://sc1.111ttt.com/2016/1/09/26/202261732256.mp3'
poster= 'http://avatar.csdn.net/E/3/9/1_u014360817.jpg'
controls="true"
name="鋼琴曲"
author="不詳"/>
<button type="primary" bindtap="audioPlay">播放</button>
<button type="primary" bindtap="audioPause">暫停</button>
<!--正常速度-->
<button type="primary" bindtap="audioPlaybackRateNormal">調(diào)為1倍速</button>
<!--慢放-->
<button type="primary" bindtap="audioPlaybackRateSlowDown">調(diào)為0.5倍速</button>
js
Page({
data:{
// text:"這是一個(gè)頁(yè)面"
action: {
method: ''
}
},
audioPlay:function() {
this.setData({
action: {
method: 'play'
}
})
},
audioPause:function(){
this.setData({
action: {
method: 'pause'
}
})
},
audioPlaybackRateNormal:function() {
this.setData({
action:{
method: 'setPlaybackRate',
data: 1
}
})
},
audioPlaybackRateSlowDown:function() {
this.setData({
action: {
method: 'setPlaybackRate',
data: 0.5
}
})
}
})
相關(guān)文章:
hello WeApp icon組件
Window text組件 switch組件
tabBar底部導(dǎo)航 progress組件 action-sheet
應(yīng)用生命周期 button組件 modal組件
頁(yè)面生命周期 checkbox組件 toast組件
模塊化詳 form組件詳 loading 組件
數(shù)據(jù)綁定 input 組件 navigator 組件
View組件 picker組件 audio 組件
scroll-view組件 radio組件 video組件
swiper組件 slider組件 Image組件
相關(guān)文章
微信小程序 網(wǎng)絡(luò)請(qǐng)求(post請(qǐng)求,get請(qǐng)求)
這篇文章主要介紹了微信小程序 網(wǎng)絡(luò)請(qǐng)求(post請(qǐng)求,get請(qǐng)求)的相關(guān)資料,需要的朋友可以參考下2017-01-01
微信小程序(應(yīng)用號(hào))簡(jiǎn)單實(shí)例應(yīng)用及實(shí)例詳解
這篇文章主要介紹了微信小程序(應(yīng)用號(hào))簡(jiǎn)單實(shí)例應(yīng)用的相關(guān)資料,需要的朋友可以參考下2016-09-09
JavaScript實(shí)現(xiàn)放大鏡詳細(xì)
這篇文章主要介紹了js實(shí)現(xiàn)放大鏡,借助寬高等比例放大的兩張圖片,結(jié)合js中鼠標(biāo)偏移量、元素偏移量、元素自身寬高等屬性完成;左側(cè)遮罩移動(dòng)Xpx,右側(cè)大圖移動(dòng)X*倍數(shù)px,具體內(nèi)容請(qǐng)需要的小伙伴出差下面文章內(nèi)容2021-12-12
Javascript實(shí)現(xiàn)的分頁(yè)函數(shù)
Javascript實(shí)現(xiàn)的分頁(yè)函數(shù)...2006-12-12

