ARCameraContext
解释:swan.createARCameraContext 的返回值。
示例
扫码体验
请使用百度APP扫码
图片示例
代码示例
Page({
data: {
src: ''
},
onShow() {
const cameraContext = swan.createCameraContext();
this.cameraContext = cameraContext
swan.showModal({
title: '这是ARCameraContext创建的实例对象',
content: JSON.stringify(cameraContext)
})
},
takePhoto() {
this.cameraContext.takePhoto({
quality: 'high',
success: res => {
this.setData({
src: res.tempImagePath
});
}
});
},
startRecord() {
this.cameraContext.startRecord({
success: res => {
swan.showToast({
title: 'startRecord'
});
}
});
},
stopRecord() {
this.cameraContext.stopRecord({
success: res => {
swan.showModal({
title: '提示',
content: res.tempVideoPath
});
this.setData({
videoSrc: res.tempVideoPath
});
}
});
}
});