查看“媒体API”的源代码
←
媒体API
跳转至:
导航
,
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== 媒体API == ==== InnerAudioContext函数 ==== InnerAudioContext实例,可通过wx.createInnerAudioContext接口获取实例 ====== 属性 ====== [[文件:属性.png|500px]] ====== 支持的格式 ====== [[文件:支持的格式.png|500px]] ====== 代码示例 ====== //index.js Page({ data: { src: 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46', poster: '../../imgs/pic.jpg', name: '普通disco', author: '佚名', src2:'../../music/light_emotion.mp3', src3: 'http://sc1.111ttt.cn:8282/2018/1/03m/13/396131229550.m4a?tflag=1546606800&pin=97bb2268ae26c20fe093fd5b0f04be80#.mp3', }, audioPlay() { this.audioData.play() console.log('播放') }, audioPause() { this.audioData.pause() console.log('暂停') }, audioPlayBack() { this.audioData.seek(this.audioData.currentTime-3) }, audioStop() { // this.audioData.stop() }, audioStart() { }, onLoad: function(options) { this.audioData =wx.createInnerAudioContext() this.audioData.src = this.data.src this.audioData.autoplay = false console.log(this.audioData) }, onReady: function() { // this.audioData = wx.createAudioContext('myAudio') }, onShow: function() { }, onHide: function() { }, onUnload: function() { }, onPullDownRefresh: function() { }, onReachBottom: function() { }, onShareAppMessage: function() { } })</nowiki> //index.wxml <!--pages/index2/index2.wxml--> <audio poster="{{poster}}" name="{{name}}" author="{{author}}" src="{{src3}}" id="myAudio" controls loop></audio> <button bindtap='audioPlay'>播放</button> <button bindtap='audioPause'>暂停</button> <button bindtap='audioPlayBack'>回放测试</button> <button bindtap='audioStop'>结束</button> <button bindtap='audioStart'>回到开头</button> <audio/>组件不再维护,可以使用能力更强的 wx.createInnerAudioContext接口. API的使用主要是看自己的项目需要什么功能,不要一味的添加。
该页面使用的模板:
模板:Author
(
查看源代码
)
模板:Name
(
查看源代码
)
模板:Poster
(
查看源代码
)
模板:Src3
(
查看源代码
)
返回至
媒体API
。
导航菜单
个人工具
登录
命名空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息