WeChat applet: Geographic location API, Image Information API

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.