WeChat applet development documentation / 微信小程序API 视频

微信小程序API 视频

wx.chooseVideo(OBJECT)


拍摄视频或从手机相册中选视频,返回视频的临时文件路径。

OBJECT参数说明:

QQ截图20170208110832.png

返回参数说明:

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
                })
            }
        })
    }
})