Home >WeChat Applet >Mini Program Development >WeChat Mini Program: Geolocation API, Image Information API
wx.chooseLocation(OBJECT)
Open the map and select the location
OBJECT parameter description:
[tr] Required description of parameter type[/tr]
success | Function | is the | interface call Successful callback function, please refer to the return parameter description for details of the return content. |
cancel | Function | No | Called when user cancels |
Function | No | Callback function for failed interface call | |
Function | No | The callback function at the end of the interface call (will be executed if the call is successful or failed) |
success return parameter description: [tr]Parameter description[/tr]
Location name | |
Detailed address | |
Latitude, floating point number, range is -90~90, negative number indicates south latitude | |
Longitude, floating point number, range is -180~180, negative number represents west longitude |
##wx.getImageInfo (OBJECT)
Get picture information
OBJECT parameter description:
[tr]Parameter type required description[/tr]
String | is the path of the | picture, which can be a relative path, a temporary file path, or a storage file Path | |
Function | No | Callback function for successful interface call | |
Function | No | Callback function for failed interface call | |
Function | No | The callback function at the end of the interface call (will be executed if the call is successful or failed) |
[tr]Parameter type description[/tr]
Number | Picture width, unit px | |
Number | Picture height unit 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)
Create and return the audio context audioContext object
audioContext
audioContext is bound to an audio component through audioId, and an audio component can be operated through it.
Method list of audioContext object:
[tr]Method parameter description[/tr]
None | Play | |
None | Pause | ## seek |
Jump to the specified position, unit 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)
Create and return the video context videoContext object
videoContext
##videoContext is bound to a video component through videoId. Through it you can operate a video component.
Method list of videoContext object:
[tr]Method parameter description[/tr]
play
pause | None | |
## seek | position | |
sendDanmu | danmu | |
Sample code: |
More WeChat mini programs: Geolocation API, For articles related to image information API, please pay attention to the PHP Chinese website!