html
<u-cell title="录像" @click="saveVideo()" :isLink="true" value="开始录像">
<view slot="value">
{{videoPath?'重新录制':'开始录像'}}
</view>
</u-cell>
js
// 录制视频
saveVideo() {
let _this = this;
uni.chooseVideo({
count: 1,
sourceType: ['camera'],
success: res => {
this.videoPath = res.tempFilePath;
},
fail: (err) => {
uni.getSetting({
success: (res) => {
let authStatus = res.authSetting['scope.camera'];
if (!authStatus) {
uni.showModal({
title: '授权失败',
content: 'Hello uni-app需要从您的相机获取视频,请在设置界面打开相关权限',
success: (res) => {
if (res.confirm) {
uni.openSetting()
}
}
})
}
}
})
}
});
},