npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@yidun/livedetect-plugin-cordova

v1.0.4

Published

yidun alive detect cordova plugin

Downloads

21

Readme

活体检测

根据提示做出相应动作,SDK 实时采集动态信息,判断用户是否为活体、真人

平台支持(兼容性)

| Android|iOS|
| ---- | ----- | | 适用版本区间:4.4以上|适用版本区间:9 - 14|

环境准备

CocoaPods安装教程

资源引入/集成

cordova plugin add @yidun/livedetect-plugin-cordova

iOS Quirks

  1. 易盾活体检测用到摄像头功能,请确保有摄像和网络权限
  2. If you are developing for iOS 10+ you must also add the following to your config.xml
<config-file platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription" overwrite="true">
  <string>Allow the app to use your camera</string>
</config-file>

<!-- or for Phonegap -->

<gap:config-file platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription" overwrite="true">
  <string>Allow the app to use your camera</string>
</gap:config-file>
  1. 编译: 将引入SDK头文件的.m文件重命名为.mm文件 或者 在Xcode中找到TARGETS-->Build Setting-->Apple Clang - Language-->Compile Source As在这个选项中选择 Objective-C++

  2. ios编译需安装pod环境。配置好开发者账号即可编译

  3. app接入活体设置(如权限设置等)请参考易盾文档

Android Quirks

  1. 易盾活体检测用到摄像头功能,请确保有摄像和网络权限
  2. 预览高度不要随意设置,请遵守大部分相机支持的预览高宽比,3:4或9:16
  3. 如果想在android设置预览的容器形状,请修改preview_layout.xml

SDK方法说明

1.初始化

  var $actionEl = document.getElementById('detectAction');  // 显示动作提示的元素
  var yidunAliveDetector = new YidunAliveDetect({
          x: 100,  // Number, 预览窗口x坐标
          y: 100,  // Number, 预览窗口y坐标
          width: 180,  // Number, 预览窗口宽度
          height: 240, // Number, 预览窗口高度
          radius: 90, // Number, 预览窗口圆角,android无效
          businessId: '从易盾申请的id'
        }, function (ev) {
          // 检测提示
          if (ev['state_tip']) {
            // 用户可以根据action_type自定义提示文案
            $actionEl.innerText = `${YidunAliveDetect.DETECT_ACTION_TYPES[ev['action_type']]}--文案: ${ev['state_tip']}`;
          } else {
            $actionEl.innerText = '';
          }
          
          // 检测结果
          if (ev['is_passed']) {
            // TODO: 处理token, ev['token']
            return;
          }
          
          // 检测失败
          if (ev['error_code']) {
            // TODO: 处理检测失败情况,ev['error_code']
            return;
          }
          
          if (ev['over_time']) {
            // TODO: 处理检测超时
            return;
          }
        });

开始检测

  yidunAliveDetector.startDetect()

停止检测

  yidunAliveDetector.stopDetect()

移除检测

  yidunAliveDetector.removeDetect()

动作类型映射

YidunAliveDetect.DETECT_ACTION_TYPES = {
    '0': '正视前方',
	'1': '向右转头',
	'2': '向左转头',
	'3': '张嘴动作',
	'4': '眨眼动作',
	'5': '动作错误(检测环境过差或者动作不标准)',
	'6': '动作通过'
};

简单示例app

cordova-yidun-alive-detect-demo for a complete working Cordova example for Android and iOS platforms.