wx.chooseLocation(OBJECT)
打开地图选择位置
OBJECT参数说明:
[tr]参数类型必填说明[/tr]
success | Function | 是 | 接口调用成功的回调函数,返回内容详见返回参数说明。 |
cancel | Function | 否 | 用户取消时调用 |
fail | Function | 否 | 接口调用失败的回调函数 |
complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
[tr]参数说明[/tr]
name | 位置名称 |
address | 详细地址 |
latitude | 纬度,浮点数,范围为-90~90,负数表示南纬 |
longitude | 经度,浮点数,范围为-180~180,负数表示西经 |
wx.getImageInfo(OBJECT)
获取图片信息
OBJECT参数说明:
[tr]参数类型必填说明[/tr]
src | String | 是 | 图片的路径,可以是相对路径,临时文件路径,存储文件路径 |
success | Function | 否 | 接口调用成功的回调函数 |
fail | Function | 否 | 接口调用失败的回调函数 |
complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
[tr]参数类型说明[/tr]
width | Number | 图片宽度,单位px |
height | Number | 图片高度 单位px |
示例代码:
wx.getImageInfo({ src: 'images/a.jpg', success: function(res) { console.log(res.width) console.log(res.height) } }) wx.chooseImage({ success: function(res) { wx.getImageInfo({ src: res.tempFilePaths[0], success: function(res) { console.log(res.width) console.log(res.height) } }) } })
wx.createAudioContext(audioId)
创建并返回 audio 上下文 audioContext 对象
audioContext
audioContext 通过 audioId 跟一个 audio 组件绑定,通过它可以操作一个 audio 组件。
audioContext对象的方法列表:
[tr]方法参数说明[/tr]
play | 无 | 播放 |
pause | 无 | 暂停 |
seek | position | 跳转到指定位置,单位 s |
示例代码:
<span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"></span> <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">播放</span> <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">暂停</span> <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">设置当前播放时间为14秒</span> <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);">回到开头</span>
audio.jsPage({ onReady: function(e) { // 使用 wx.createAudioContext 获取 audio 上下文 context this.audioCtx = wx.createAudioContext('myAudio') }, data: { 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() }, audio14: function() { this.audioCtx.seek(14) }, audioStart: function() { this.audioCtx.seek(0) } })
wx.createVideoContext(videoId)
创建并返回 video 上下文 videoContext 对象
videoContext
videoContext 通过 videoId 跟一个 video 组件绑定,通过它可以操作一个 video 组件。
videoContext对象的方法列表:
[tr]方法参数说明[/tr]
play | 无 | 播放 |
pause | 无 | 暂停 |
seek | position | 跳转到指定位置,单位 s |
sendDanmu | danmu | 发送弹幕,danmu 包含两个属性 text, color。 |
示例代码:
<span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"> <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"/> <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"> <span class="hljs-tag" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; font-size: inherit; color: rgb(200, 40, 41);"/> </span> </span>
更多微信小程序:地理位置 API,图片信息 API相关文章请关注PHP中文网!
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章
如何修复KB5055612无法在Windows 10中安装?
3 周前ByDDD
<🎜>:种植花园 - 完整的突变指南
3 周前ByDDD
<🎜>:泡泡胶模拟器无穷大 - 如何获取和使用皇家钥匙
3 周前By尊渡假赌尊渡假赌尊渡假赌
北端:融合系统,解释
3 周前By尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆树的耳语 - 如何解锁抓钩
3 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

WebStorm Mac版
好用的JavaScript开发工具

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境