原生相机自定义蒙版的UTS插件
Project Start
2025-02-28
Crowdfunding Success
2024-02-01
Launch
2025-02-28
bsf-mask-camera 是基于原生相机开发的UTS插件,可自定义蒙版用于人脸识别,身份证拍照等。
<bsf-mask-camera 
  ref="CameraView" 
  @onPermissionDeny="onPermissionDeny"
  @onTakePhoto="onTakePhoto" 
  @onGetFrame="onGetFrame"
  :style="{ height: cameraHeight + 'px', width: cameraWidth + 'px' }"
></bsf-mask-camera>
拍照并返回照片数据。
this.$refs.CameraView.takePicture()
开启帧监听。
参数
options: Object
width: Number - 帧宽度height: Number - 帧高度this.$refs.CameraView.startFrame({
  width: 320,
  height: 640
})
停止帧监听。
this.$refs.CameraView.stopFrame()
关闭相机。
this.$refs.CameraView.stopCamera()
切换前后摄像头。
this.$refs.CameraView.switchCamera()
切换闪光灯开关。
this.$refs.CameraView.switchFlash()
相机权限被拒绝时触发。
拍照完成时触发,返回照片数据。
获取视频帧时触发,返回帧数据。
export default {
  methods: {
    takePhoto() {
      this.$refs.CameraView.takePicture()
    },
    
    onTakePhoto(res) {
      console.log('照片数据:', res)
    },
    
    onPermissionDeny() {
      uni.showToast({
        title: '相机权限被拒绝',
        icon: 'error'
      })
    },
    
    onGetFrame(res) {
      console.log('帧数据:', res) 
    }
  }
}
将内容保存到 iCloud。
参数
options: Object
fileName: String - 文件名称content: String - 要保存的内容success: Function - 成功回调函数fail: Function - 失败回调函数,参数为错误信息示例
Icloud.saveContentToICloud({
  fileName: '1.txt',
  content: '要保存的内容',
  success: () => {
    console.log('保存成功');
  },
  fail: (err) => {
    console.error('保存失败:', err);
  }
});
文档正在制作中,敬请期待...
No versions released yet