This article introduces applets: Geographic location API, Image Information API wx. chooseLocation (OBJECT)
Open a map and select a location
OBJECT parameter description:
[Tr] parameter type required description [/tr]
| Success |
Function |
Yes |
The callback function that is successfully called by the API. for details about the returned content, see the return parameter description. |
| Cancel |
Function |
No |
Called upon cancellation |
| Fail |
Function |
No |
Callback function for interface call failure |
| Complete |
Function |
No |
The callback function after the interface call ends. (the callback function is executed if the call succeeds or fails) |
Success return parameters:
[Tr] parameter description [/tr]
| Name |
Location Name |
| Address |
Detailed address |
| Latitude |
Latitude, floating point number, range:-90 ~ 90. a negative number indicates the southern latitude. |
| Longpolling |
Longitude, floating point number, range:-180 ~ 180, negative number indicates the western longitude |
Wx. getImageInfo (OBJECT)
Obtain image information
OBJECT parameter description:
[Tr] parameter type required description [/tr]
| Src |
String |
Yes |
The path of the image. it can be a relative path, a temporary file path, or a storage file path. |
| Success |
Function |
No |
Callback function for successful API call |
| Fail |
Function |
No |
Callback function for interface call failure |
| Complete |
Function |
No |
The callback function after the interface call ends. (the callback function is executed if the call succeeds or fails) |
Success return parameters:
[Tr] parameter type description [/tr]
| Width |
Number |
Image width, in pixels |
| Height |
Number |
Image height unit: px |
Sample code:
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, which allows you to operate an audio component.
Method list of the audioContext object:
[Tr] method parameter description [/tr]
| Play |
None |
Play |
| Pause |
None |
Pause |
| Seek |
Position |
Jump to the specified position, in seconds |
Sample code:
Set the current playback time to 14 seconds and return to the beginning.
Audio. jsPage ({onReady: function (e) {// use wx. createAudioContext get audio context this. audioCtx = wx. createAudioContext ('myaudio')}, data: {src: 'http: // ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3? Guid = ffffff82def4af4b12b3cd9337d5e7 & uin = 346897220 & vkey = found & 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, which allows you to operate a video component.
Method list of the videoContext object:
[Tr] method parameter description [/tr]
| Play |
None |
Play |
| Pause |
None |
Pause |
| Seek |
Position |
Jump to the specified position, in seconds |
| SendDanmu |
Danmu |
Send a Bullet screen. danmu contains two attributes: text and color. |
Sample code:
More applets: Geographic location API, Image Information API related articles, please follow the PHP Chinese network!