WeChat Mini Program API Video


wx.chooseVideo(OBJECT)


Shoot a video or select a video from the mobile phone album, and return the temporary file path of the video.

OBJECT parameter description:

QQ截图20170208110832.png

Return parameter description:

QQ截图20170208110844.png

<view class="container">
    <video src="{{src}}"></video>
    <button bindtap="bindButtonTap">获取视频</button>
</view>
    data:{
        src:""
    },
    bindButtonTap:function(){
        var that = this;
        wx.chooseVideo({
            sourceType:['album','camera'],
            maxDuration:60,
            camera:['front','back'],
            success:function(res){
                that.setData({
                    src:res.tempFilePath
                })
            }
        })
    }
})