欧美日韩国产一区,亚洲一区视频,色综合久久久久,私密按摩师舌头伸进去了,99re6这里只有精品,夜夜性日日交xxx性hd

audio音頻

本文編輯: Owen Owen瀏覽 4191 版權所有,嚴禁轉載

組件說明:

  • audio為音頻組件,我們可以輕松的在小程序中播放音頻

組件用法:

wxml

<!-- audio.wxml -->
<audio poster="{{poster}}" name="{{name}}" author="{{author}}" src="{{src}}" id="myAudio" controls loop></audio>

<button type="primary" bindtap="audioPlay">播放</button>
<button type="primary" bindtap="audioPause">暫停</button>
<button type="primary" bindtap="audio14">設置當前播放時間為14秒</button>
<button type="primary" bindtap="audioStart">回到開頭</button>

js

// audio.js
Page({
  onReady: function (e) {
    // 使用 wx.createAudioContext 獲取 audio 上下文 context
    this.audioCtx = wx.createAudioContext('myAudio')
  },
  data: {
    poster: 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000',
    name: '此時此刻',
    author: '許巍',
    src: 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46',
  },
audioPlay: function () {
    this.audioCtx.play()
  },
  audioPause: function () {
    this.audioCtx.pause()
    console.log("audioPause");
  },
  audio14: function () {
    this.audioCtx.seek(14)
    console.log("跳至第14秒播放");
  },
  audioStart: function () {
    this.audioCtx.seek(0)
    console.log("回到開頭")
  },

})

主要屬性:

  • 設置音頻組件的內容,用于wxml
屬性 類型 說明
id String video 組件的唯一標識符
src String 要播放音頻的資源地址
loop Boolean 是否循環播放
controls Boolean 是否顯示默認控件
poster String 默認控件上的音頻封面的圖片資源地址,如果 controls 屬性值為 false 則設置 poster 無效
name String 默認控件上的音頻名字,如果 controls 屬性值為 false 則設置 name 無效
author String 默認控件上的作者名字,如果 controls 屬性值為 false 則設置 author 無效
  • 監聽音頻播放的事件,用于js
屬性 類型 說明
binderror EventHandle 當發生錯誤時觸發 error 事件,detail = {errMsg: MediaError.code}
bindplay EventHandle 當開始/繼續播放時觸發play事件
bindpause EventHandle 當暫停播放時觸發 pause 事件
bindtimeupdate EventHandle 當播放進度改變時觸發 timeupdate 事件,detail = {currentTime, duration}
bindended EventHandle 當播放到末尾時觸發 ended 事件
如有技術問題或對本文有反饋,請加入QQ群:
微信小程序實戰5營: 微信小程序Club實戰5營