Home WeChat Applet Mini Program Development WeChat Mini Program: Geolocation API, Image Information API

WeChat Mini Program: Geolocation API, Image Information API

Mar 03, 2017 am 10:39 AM
WeChat applet

wx.chooseLocation(OBJECT)

Open the map and select the location
OBJECT parameter description:
[tr] Required description of parameter type[/tr]

##fail FunctionNoCallback function for failed interface callcompleteFunctionNoThe callback function at the end of the interface call (will be executed if the call is successful or failed)
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

success return parameter description: [tr]Parameter description[/tr]

nameLocation nameaddressDetailed addresslatitudeLatitude, floating point number, range is -90~90, negative number indicates south latitudelongitudeLongitude, 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]

srcsuccessfailcomplete
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)
success return parameter description:

[tr]Parameter type description[/tr]

widthheight
Number Picture width, unit px
Number Picture 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)
            }
        })
    }
})
Copy after login

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]

playpause## seekpositionJump to the specified position, unit sSample code:
NonePlay
NonePause

 <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>
Copy after login

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)
    }
})
Copy after login



##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

NonePlaypauseNonePauseJump to the specified position, unit sSend bomb Curtain, danmu contains two attributes 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>
Copy after login

More WeChat mini programs: Geolocation API, For articles related to image information API, please pay attention to the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Xianyu WeChat mini program officially launched Xianyu WeChat mini program officially launched Feb 10, 2024 pm 10:39 PM

Xianyu WeChat mini program officially launched

What is the name of Xianyu WeChat applet? What is the name of Xianyu WeChat applet? Feb 27, 2024 pm 01:11 PM

What is the name of Xianyu WeChat applet?

WeChat applet implements image upload function WeChat applet implements image upload function Nov 21, 2023 am 09:08 AM

WeChat applet implements image upload function

Implement the drop-down menu effect in WeChat applet Implement the drop-down menu effect in WeChat applet Nov 21, 2023 pm 03:03 PM

Implement the drop-down menu effect in WeChat applet

How to use PHP to develop the second-hand transaction function of WeChat applet? How to use PHP to develop the second-hand transaction function of WeChat applet? Oct 27, 2023 pm 05:15 PM

How to use PHP to develop the second-hand transaction function of WeChat applet?

Use WeChat applet to achieve carousel switching effect Use WeChat applet to achieve carousel switching effect Nov 21, 2023 pm 05:59 PM

Use WeChat applet to achieve carousel switching effect

Implement image filter effects in WeChat mini programs Implement image filter effects in WeChat mini programs Nov 21, 2023 pm 06:22 PM

Implement image filter effects in WeChat mini programs

Implement image rotation effect in WeChat applet Implement image rotation effect in WeChat applet Nov 21, 2023 am 08:26 AM

Implement image rotation effect in WeChat applet

See all articles
## seekposition
sendDanmudanmu
Sample code: