WeChat Mini Program: Geolocation API, Image Information API

高洛峰
Release: 2017-03-03 10:39:00
Original
1749 people have browsed it

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(&#39;myAudio&#39;)
    },
    data: {
        src: &#39;http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46&#39;,
    },
    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!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!
## seekposition
sendDanmudanmu
Sample code: