微信小程序如何调用camera组件拍摄视频?
网友回复
完整的代码如下:
wxml
<view class="container"> <camera device-position="back" flash="off" class="camera"></camera> <view class="btngroup"> <button bindtap="startRecording">开始录制</button> <button bindtap="stopRecording">停止录制</button> </view> <video wx:if="{{videoSrc}}" src="{{videoSrc}}" controls></video> </view>js
Page({ data: { videoSrc: '', isRecording: false }, onLoad: function() { }, startRecording: function() { const that = this; const cameraContext = wx.createCameraContext(); cameraContext.startRecord({ success: (res) => { console.log('开始录制视频'); that.setData({ isRecording: true }); ...
点击查看剩余70%