微信小程式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
                })
            }
        })
    }
})